- PolyData.compute_implicit_distance(surface, inplace=False)#
Compute the implicit distance from the points to a surface.
This filter will compute the implicit distance from all of the nodes of this mesh to a given surface. This distance will be added as a point array called
Dataset containing the
Compute the distance between all the points on a sphere and a plane.
>>> import pyvista as pv >>> sphere = pv.Sphere() >>> plane = pv.Plane() >>> _ = sphere.compute_implicit_distance(plane, inplace=True) >>> dist = sphere['implicit_distance'] >>> type(dist) <class 'numpy.ndarray'>
Plot these distances as a heatmap
>>> pl = pv.Plotter() >>> _ = pl.add_mesh(sphere, scalars='implicit_distance', cmap='bwr') >>> _ = pl.add_mesh(plane, color='w', style='wireframe') >>> pl.show()