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: Clean the mesh.
  
  This merges duplicate points, removes unused points, and/or
  removes degenerate cells.
  
  Parameters
  ----------
  point_merging : bool, optional
      Enables point merging.  ``True`` by default.
  
  tolerance : float, optional
      Set merging tolerance.  When enabled merging is set to
      absolute distance. If ``absolute`` is ``False``, then the
      merging tolerance is a fraction of the bounding box
      length. The alias ``merge_tol`` is also excepted.
  
  lines_to_points : bool, optional
      Enable or disable the conversion of degenerate lines to
      points.  Enabled by default.
  
  polys_to_lines : bool, optional
      Enable or disable the conversion of degenerate polys to
      lines.  Enabled by default.
  
  strips_to_polys : bool, optional
      Enable or disable the conversion of degenerate strips to
      polys.
  
  inplace : bool, default: False
      Updates mesh in-place.
  
  absolute : bool, optional
      Control if ``tolerance`` is an absolute distance or a
      fraction.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  **kwargs : dict, optional
      Accepts for ``merge_tol`` to replace the ``tolerance``
      keyword argument.  This may be deprecated in future.
  
  Returns
  -------
  pyvista.PolyData
      Cleaned mesh.
  
  Examples
  --------
  Create a mesh with a degenerate face and then clean it,
  removing the degenerate face
  
  >>> import pyvista as pv
  >>> import numpy as np
  >>> points = np.array(
  ...     [[0, 0, 0], [0, 1, 0], [1, 0, 0]], dtype=np.float32
  ... )
  >>> faces = np.array([3, 0, 1, 2, 3, 0, 2, 2])
  >>> mesh = pv.PolyData(points, faces)
  >>> mout = mesh.clean()
  >>> mout.faces  # doctest:+SKIP
  array([3, 0, 1, 2])
docstr_tok: ["Clean","the","mesh",".","This","merges","duplicate","points",",","removes","unused","points",",","and\/or","removes","degenerate","cells",".","Parameters","--","--","--","--","--","point_merging",":","bool",",","optional","Enables","point","merging",".","``","True","``","by","default",".","tolerance",":","float",",","optional","Set","merging","tolerance",".","When","enabled","merging","is","set","to","absolute","distance",".","If","``","absolute","``","is","``","False","``",",","then","the","merging","tolerance","is","a","fraction","of","the","bounding","box","length",".","The","alias","``","merge_tol","``","is","also","excepted",".","lines_to_points",":","bool",",","optional","Enable","or","disable","the","conversion","of","degenerate","lines","to","points",".","Enabled","by","default",".","polys_to_lines",":","bool",",","optional","Enable","or","disable","the","conversion","of","degenerate","polys","to","lines",".","Enabled","by","default",".","strips_to_polys",":","bool",",","optional","Enable","or","disable","the","conversion","of","degenerate","strips","to","polys",".","inplace",":","bool",",","default",":","False","Updates","mesh","in-place",".","absolute",":","bool",",","optional","Control","if","``","tolerance","``","is","an","absolute","distance","or","a","fraction",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","*","*","kwargs",":","dict",",","optional","Accepts","for","``","merge_tol","``","to","replace","the","``","tolerance","``","keyword","argument",".","This","may","be","deprecated","in","future",".","Returns","--","--","--","-","pyvista.PolyData","Cleaned","mesh",".","Examples","--","--","--","--","Create","a","mesh","with","a","degenerate","face","and","then","clean","it",",","removing","the","degenerate","face",">",">",">","import","pyvista","as","pv",">",">",">","import","numpy","as","np",">",">",">","points","=","np.array","(","...","[","[","0",",","0",",","0","]",",","[","0",",","1",",","0","]",",","[","1",",","0",",","0","]","]",",","dtype=np.float32","...",")",">",">",">","faces","=","np.array","(","[","3",",","0",",","1",",","2",",","3",",","0",",","2",",","2","]",")",">",">",">","mesh","=","pv.PolyData","(","points",",","faces",")",">",">",">","mout","=","mesh.clean","(",")",">",">",">","mout.faces","#","doctest",":","+SKIP","array","(","[","3",",","0",",","1",",","2","]",")"]
code: def clean(
      self,
      point_merging=True,
      tolerance=None,
      lines_to_points=True,
      polys_to_lines=True,
      strips_to_polys=True,
      inplace=False,
      absolute=True,
      progress_bar=False,
      **kwargs,
  ):
      """Clean the mesh.
  
      This merges duplicate points, removes unused points, and/or
      removes degenerate cells.
  
      Parameters
      ----------
      point_merging : bool, optional
          Enables point merging.  ``True`` by default.
  
      tolerance : float, optional
          Set merging tolerance.  When enabled merging is set to
          absolute distance. If ``absolute`` is ``False``, then the
          merging tolerance is a fraction of the bounding box
          length. The alias ``merge_tol`` is also excepted.
  
      lines_to_points : bool, optional
          Enable or disable the conversion of degenerate lines to
          points.  Enabled by default.
  
      polys_to_lines : bool, optional
          Enable or disable the conversion of degenerate polys to
          lines.  Enabled by default.
  
      strips_to_polys : bool, optional
          Enable or disable the conversion of degenerate strips to
          polys.
  
      inplace : bool, default: False
          Updates mesh in-place.
  
      absolute : bool, optional
          Control if ``tolerance`` is an absolute distance or a
          fraction.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      **kwargs : dict, optional
          Accepts for ``merge_tol`` to replace the ``tolerance``
          keyword argument.  This may be deprecated in future.
  
      Returns
      -------
      pyvista.PolyData
          Cleaned mesh.
  
      Examples
      --------
      Create a mesh with a degenerate face and then clean it,
      removing the degenerate face
  
      >>> import pyvista as pv
      >>> import numpy as np
      >>> points = np.array(
      ...     [[0, 0, 0], [0, 1, 0], [1, 0, 0]], dtype=np.float32
      ... )
      >>> faces = np.array([3, 0, 1, 2, 3, 0, 2, 2])
      >>> mesh = pv.PolyData(points, faces)
      >>> mout = mesh.clean()
      >>> mout.faces  # doctest:+SKIP
      array([3, 0, 1, 2])
  
      """
      if tolerance is None:
          tolerance = kwargs.pop("merge_tol", None)
      assert_empty_kwargs(**kwargs)
      alg = _vtk.vtkCleanPolyData()
      alg.SetPointMerging(point_merging)
      alg.SetConvertLinesToPoints(lines_to_points)
      alg.SetConvertPolysToLines(polys_to_lines)
      alg.SetConvertStripsToPolys(strips_to_polys)
      if isinstance(tolerance, (int, float)):
          if absolute:
              alg.ToleranceIsAbsoluteOn()
              alg.SetAbsoluteTolerance(tolerance)
          else:
              alg.SetTolerance(tolerance)
      alg.SetInputData(self)
      _update_alg(alg, progress_bar, "Cleaning")
      output = _get_output(alg)
  
      # Check output so no segfaults occur
      if output.n_points < 1 and self.n_cells > 0:
          raise ValueError(
              "Clean tolerance is too high. Empty mesh returned."
          )
  
      if inplace:
          self.copy_from(output, deep=False)
          return self
      return output
  
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 24 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.clean(point_merging, tolerance, lines_to_points, polys_to_lines, strips_to_polys, inplace, absolute, progress_bar) and returns: output, self