pyvista.PolyDataFilters.remove_points#

PolyDataFilters.remove_points(remove, mode='any', keep_scalars=True, inplace=False)[source]#

Rebuild a mesh by removing points.

Only valid for all-triangle meshes.

Parameters:
removesequence[bool | int]

If remove is a bool array, points that are True will be removed. Otherwise, it is treated as a list of indices.

modestr, default: “any”

When 'all', only faces containing all points flagged for removal will be removed.

keep_scalarsbool, default: True

When True, point and cell scalars will be passed on to the new mesh.

inplacebool, default: False

Updates mesh in-place.

Returns:
pyvista.PolyData

Mesh without the points flagged for removal.

numpy.ndarray

Indices of new points relative to the original mesh.

Examples

Remove the first 100 points from a sphere.

>>> import pyvista as pv
>>> sphere = pv.Sphere()
>>> reduced_sphere, ridx = sphere.remove_points(range(100, 250))
>>> reduced_sphere.plot(show_edges=True, line_width=3)
../../../_images/pyvista-PolyDataFilters-remove_points-1_00_00.png