- PolyData.reconstruct_surface(nbr_sz=None, sample_spacing=None, progress_bar=False)#
Reconstruct a surface from the points in this dataset.
This filter takes a list of points assumed to lie on the surface of a solid 3D object. A signed measure of the distance to the surface is computed and sampled on a regular grid. The grid can then be contoured at zero to extract the surface. The default values for neighborhood size and sample spacing should give reasonable results for most uses but can be set if desired.
This is helpful when generating surfaces from point clouds and is more reliable than
Specify the number of neighbors each point has, used for estimating the local surface orientation.
The default value of 20 should be fine for most applications, higher values can be specified if the spread of points is uneven. Values as low as 10 may yield adequate results for some surfaces. Higher values cause the algorithm to take longer and will cause errors on sharp boundaries.
The spacing of the 3D sampling grid. If not set, a reasonable guess will be made.
Display a progress bar to indicate progress.
Create a point cloud out of a sphere and reconstruct a surface from it.
>>> import pyvista as pv >>> points = pv.wrap(pv.Sphere().points) >>> surf = points.reconstruct_surface()
>>> pl = pv.Plotter(shape=(1,2)) >>> _ = pl.add_mesh(points) >>> _ = pl.add_title('Point Cloud of 3D Surface') >>> pl.subplot(0,1) >>> _ = pl.add_mesh(surf, color=True, show_edges=True) >>> _ = pl.add_title('Reconstructed Surface') >>> pl.show()
See Surface Reconstruction for more examples using this filter.