select_enclosed_points

ExplicitStructuredGrid.select_enclosed_points(surface, tolerance=0.001, inside_out=False, check_surface=True, progress_bar=False)

Mark points as to whether they are inside a closed surface.

This evaluates all the input points to determine whether they are in an enclosed surface. The filter produces a (0,1) mask (in the form of a vtkDataArray) that indicates whether points are outside (mask value=0) or inside (mask value=1) a provided surface. (The name of the output vtkDataArray is "SelectedPoints".)

This filter produces and output data array, but does not modify the input dataset. If you wish to extract cells or poinrs, various threshold filters are available (i.e., threshold the output array).

Warning

The filter assumes that the surface is closed and manifold. A boolean flag can be set to force the filter to first check whether this is true. If False and not manifold, an error will be raised.

Parameters
surfacepyvista.PolyData

Set the surface to be used to test for containment. This must be a pyvista.PolyData object.

tolerancefloat, optional

The tolerance on the intersection. The tolerance is expressed as a fraction of the bounding box of the enclosing surface.

inside_outbool, optional

By default, points inside the surface are marked inside or sent to the output. If inside_out is True, then the points outside the surface are marked inside.

check_surfacebool, optional

Specify whether to check the surface for closure. If on, then the algorithm first checks to see if the surface is closed and manifold. If the surface is not closed and manifold, a runtime error is raised.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.PolyData

Mesh containing the point_data['SelectedPoints'] array.

Examples

Determine which points on a plane are inside a manifold sphere surface mesh. Extract these points using the DataSetFilters.extract_points() filter and then plot them.

>>> import pyvista
>>> sphere = pyvista.Sphere()
>>> plane = pyvista.Plane()
>>> selected = plane.select_enclosed_points(sphere)
>>> pts = plane.extract_points(selected['SelectedPoints'].view(bool),
...                            adjacent_cells=False)
>>> pl = pyvista.Plotter()
>>> _ = pl.add_mesh(sphere, style='wireframe')
>>> _ = pl.add_points(pts, color='r')
>>> pl.show()
../../../_images/pyvista-ExplicitStructuredGrid-select_enclosed_points-1_00_00.png