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

LB berthe.loic@gmail....
Wed Apr 1 12:40:57 CDT 2009

```> 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?
It may be possible, with some manual transformation of the data
points, but I would prefer a more generic approach if possible.

> 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.

The method c) seems the simplest at first sight but I see two issues
for this local approach :
- the measured data are noisy. Using the nearest neighbor could give
a noisy result two, especially when looking at a radius of curvature
- I don't see how to use this approach to plot the variation of
radius of curvature along the surface, It can give me an array of
radius of curvature, but as my data are not regularly spaced, it won't
be easy to handle.

Th method b) seems very fuzzy to me : I don't have any knowledge in
manifold-learning and I would have the second issue of the method c)
too.

The method a) is what I had initially in mind, but I didn't see how to
do this in scipy :-(
I believed at first that I could make a sort of parametric bispline
fit with the functions available in scipy.interpolate, but I didn't
succeed in.
Do you have any example or hint for doing this kind of treatment in
scipy ?

LB
```

More information about the SciPy-user mailing list