class_docstr: An internal class to manage filters/algorithms for polydata datasets.
class_docstr_tok: ["An","internal","class","to","manage","filters\/algorithms","for","polydata","datasets","."]
docstr: Rebuild a mesh by removing points.
  
  Only valid for all-triangle meshes.
  
  Parameters
  ----------
  remove : sequence[bool | int]
      If remove is a bool array, points that are ``True`` will
      be removed.  Otherwise, it is treated as a list of
      indices.
  
  mode : str, default: "any"
      When ``'all'``, only faces containing all points flagged
      for removal will be removed.
  
  keep_scalars : bool, default: True
      When ``True``, point and cell scalars will be passed on to
      the new mesh.
  
  inplace : bool, 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)
docstr_tok: ["Rebuild","a","mesh","by","removing","points",".","Only","valid","for","all-triangle","meshes",".","Parameters","--","--","--","--","--","remove",":","sequence","[","bool","|","int","]","If","remove","is","a","bool","array",",","points","that","are","``","True","``","will","be","removed",".","Otherwise",",","it","is","treated","as","a","list","of","indices",".","mode",":","str",",","default",":","``","any","''","When","``","'all","'","``",",","only","faces","containing","all","points","flagged","for","removal","will","be","removed",".","keep_scalars",":","bool",",","default",":","True","When","``","True","``",",","point","and","cell","scalars","will","be","passed","on","to","the","new","mesh",".","inplace",":","bool",",","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",")"]
code: def remove_points(
      self, remove, mode="any", keep_scalars=True, inplace=False
  ):
      """Rebuild a mesh by removing points.
  
      Only valid for all-triangle meshes.
  
      Parameters
      ----------
      remove : sequence[bool | int]
          If remove is a bool array, points that are ``True`` will
          be removed.  Otherwise, it is treated as a list of
          indices.
  
      mode : str, default: "any"
          When ``'all'``, only faces containing all points flagged
          for removal will be removed.
  
      keep_scalars : bool, default: True
          When ``True``, point and cell scalars will be passed on to
          the new mesh.
  
      inplace : bool, 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)
  
      """
      remove = np.asarray(remove)
  
      # np.asarray will eat anything, so we have to weed out bogus inputs
      if not issubclass(remove.dtype.type, (np.bool_, np.integer)):
          raise TypeError(
              "Remove must be either a mask or an integer array-like"
          )
  
      if remove.dtype == np.bool_:
          if remove.size != self.n_points:
              raise ValueError("Mask different size than n_points")
          remove_mask = remove
      else:
          remove_mask = np.zeros(self.n_points, np.bool_)
          remove_mask[remove] = True
  
      if not self.is_all_triangles:
          raise NotAllTrianglesError
  
      f = self.faces.reshape(-1, 4)[:, 1:]
      vmask = remove_mask.take(f)
      if mode == "all":
          fmask = ~(vmask).all(1)
      else:
          fmask = ~(vmask).any(1)
  
      # Regenerate face and point arrays
      uni = np.unique(f.compress(fmask, 0), return_inverse=True)
      new_points = self.points.take(uni[0], 0)
  
      nfaces = fmask.sum()
      faces = np.empty((nfaces, 4), dtype=pyvista.ID_TYPE)
      faces[:, 0] = 3
      faces[:, 1:] = np.reshape(uni[1], (nfaces, 3))
  
      newmesh = pyvista.PolyData(new_points, faces, deep=True)
      ridx = uni[0]
  
      # Add scalars back to mesh if requested
      if keep_scalars:
          for key in self.point_data:
              newmesh.point_data[key] = self.point_data[key][ridx]
  
          for key in self.cell_data:
              try:
                  newmesh.cell_data[key] = self.cell_data[key][fmask]
              except:
                  warnings.warn(
                      f"Unable to pass cell key {key} onto reduced mesh"
                  )
  
      # Return vtk surface and reverse indexing array
      if inplace:
          self.copy_from(newmesh, deep=False)
          return self, ridx
      return newmesh, ridx
  
imports: import collections.abc
  import warnings
  import numpy
  import pyvista
  from pyvista.core import _vtk_core
  from pyvista.core.errors import MissingDataError, NotAllTrianglesError, PyVistaFutureWarning, VTKVersionError
  from pyvista.core.filters import _get_output, _update_alg
  from pyvista.core.filters.data_set import DataSetFilters
  from pyvista.core.utilities.arrays import FieldAssociation, get_array, get_array_association, set_default_active_scalars, vtk_id_list_to_array
  from pyvista.core.utilities.geometric_objects import NORMALS
  from pyvista.core.utilities.helpers import generate_plane, wrap
  from pyvista.core.utilities.misc import abstract_class, assert_empty_kwargs
label_desc: Use image node_id 31 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.remove_points(remove, mode, keep_scalars, inplace) and returns: newmesh,  ridx, self,  ridx