[SciPy-user] How to fit a surface from a list of measured 3D points ?

Zachary Pincus zachary.pincus@yale....
Wed Apr 1 10:30:34 CDT 2009


> I would like to estimate some geoemetric characteristic of this
> surface and view the variation of radius of curvature.
>> What's your eventual goal for the fit surface? There are a lot of
>> possible approaches possible with the tools in scipy (e.g. fit a
>> spline, as you have done, or fit a simpler parameteric surface in a
>> least-squares fashion, or go for a nonparametric approach and
>> interpolate between the points with radial basis functions).  The  
>> best
>> approach will likely depend on what you want to do with the  
>> surface...
>> but what you have seems like a reasonable start.
> I think a 2D surface spline could do the trick, but  I think I didn't
> fit it well :
> - the estimated z can go far below the range of my inputs ( [48-62] )
> - As you can see on small_data.jpg, the surface is really 3D, there is
> a kind of crease in my surface, and there are two z value for (x,y) ~
> (2,2). So I 'm not sure if this is the good approach

Hmm, good point. Can you rotate the data points in the 3D space so  
that the new z values do become a proper function in two dimensions?  
If not, then you'll have to:
a) fit a surface to all of the data in 3D (something done a lot by  
computer graphics and robotics people, who get point clouds as return  
data from LIDAR scanners and similar, and then try to fit the points  
to 3D surfaces for visualization / navigation)

b) Find locally-smooth patches and fit surfaces to these individually  
(the manifold-learning folks do this, e.g. "Hessian LLE"). Say you're  
interested in curvature around a given data point (x, y, z)... you  
could take the points within some neighborhood and then either fit  
them to a simple 3d surface (like some kind of paraboloid), or figure  
out (with e.g. PCA) the best projection of those data points to a  
plane, and then fit a surface to f(x, y) -> z for the transformed data.

or perhaps even c) just calculate what you need from the data points  
directly. If you just need very local curvature data, you could  
probably calculate that from a point and its nearest neighbors. (This  
is really just a degenerate case of b...)

Lots of tools for these tasks are in scipy, but nothing off-the-shelf  
that I know if.


More information about the SciPy-user mailing list