I have a bunch of 3D data points and I am fitting a surface through them using scipy thin plate splines as follows:
import numpy as np
import scipy as sp
import scipy.interpolate
# x, y, z are the 3D point coordinates
spline = sp.interpolate.Rbf(x, y, z, function='thin_plate', smooth=5, episilon=5)
x_grid = np.linspace(0, 512, 1024)
y_grid = np.linspace(0, 512, 1024)
B1, B2 = np.meshgrid(x_grid, y_grid, indexing='xy')
Z = spline(B1, B2)
This fits the surface as desired as shown in the attached image.
Now what I want to do is be able to query where this spline intersects a given plane.
So, given this fitted surface, how can I query at what (x, y)
points this surface cuts the plane (z = 25)
for example.
So, the code above is fitting:
z = f(x, y)
and now that the f
is fitted, I wonder if it is possible to do the inverse look up i.e. I want to do f^{-1}(z)