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: Reduce the number of triangles in a triangular mesh using ``vtkQuadricDecimation``.
  
  Parameters
  ----------
  target_reduction : float
      Fraction of the original mesh to remove.
      If ``target_reduction`` is set to 0.9, this filter will try
      to reduce the data set to 10% of its original size and will
      remove 90% of the input triangles.
  
  volume_preservation : bool, default: False
      Decide whether to activate volume preservation which greatly
      reduces errors in triangle normal direction. If ``False``,
      volume preservation is disabled and if ``attribute_error``
      is active, these errors can be large.
  
  attribute_error : bool, default: False
      Decide whether to include data attributes in the error metric. If
      ``False``, then only geometric error is used to control the
      decimation. If ``True``, the following flags are used to specify
      which attributes are to be included in the error calculation.
  
  scalars : bool, default: True
      If attribute errors are to be included in the metric (i.e.,
      ``attribute_error`` is ``True``), then these flags control
      which attributes are to be included in the error
      calculation.
  
  vectors : bool, default: True
      See ``scalars`` parameter.
  
  normals : bool, default: False
      See ``scalars`` parameter.
  
  tcoords : bool, default: True
      See ``scalars`` parameter.
  
  tensors : bool, default: True
      See ``scalars`` parameter.
  
  scalars_weight : float, default: 0.1
      The scaling weight contribution of the scalar attribute.
      These values are used to weight the contribution of the
      attributes towards the error metric.
  
  vectors_weight : float, default: 0.1
      See ``scalars_weight`` parameter.
  
  normals_weight : float, default: 0.1
      See ``scalars_weight`` parameter.
  
  tcoords_weight : float, default: 0.1
      See ``scalars_weight`` parameter.
  
  tensors_weight : float, default: 0.1
      See ``scalars_weight`` parameter.
  
  inplace : bool, default: False
      Whether to update the mesh in-place.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  Returns
  -------
  pyvista.PolyData
      Decimated mesh.
  
  Notes
  -----
  If you encounter a segmentation fault or other error, consider using
  :func:`pyvista.PolyDataFilters.clean` to remove any invalid cells
  before using this filter.
  
  Examples
  --------
  Decimate a sphere.  First plot the sphere.
  
  >>> import pyvista as pv
  >>> sphere = pv.Sphere(phi_resolution=60, theta_resolution=60)
  >>> sphere.plot(show_edges=True, line_width=2)
  
  Now decimate it by 75% and plot it.
  
  >>> decimated = sphere.decimate(0.75)
  >>> decimated.plot(show_edges=True, line_width=2)
  
  See :ref:`decimate_example` for more examples using this filter.
docstr_tok: ["Reduce","the","number","of","triangles","in","a","triangular","mesh","using","``","vtkQuadricDecimation","``",".","Parameters","--","--","--","--","--","target_reduction",":","float","Fraction","of","the","original","mesh","to","remove",".","If","``","target_reduction","``","is","set","to","0.9",",","this","filter","will","try","to","reduce","the","data","set","to","10","%","of","its","original","size","and","will","remove","90","%","of","the","input","triangles",".","volume_preservation",":","bool",",","default",":","False","Decide","whether","to","activate","volume","preservation","which","greatly","reduces","errors","in","triangle","normal","direction",".","If","``","False","``",",","volume","preservation","is","disabled","and","if","``","attribute_error","``","is","active",",","these","errors","can","be","large",".","attribute_error",":","bool",",","default",":","False","Decide","whether","to","include","data","attributes","in","the","error","metric",".","If","``","False","``",",","then","only","geometric","error","is","used","to","control","the","decimation",".","If","``","True","``",",","the","following","flags","are","used","to","specify","which","attributes","are","to","be","included","in","the","error","calculation",".","scalars",":","bool",",","default",":","True","If","attribute","errors","are","to","be","included","in","the","metric","(","i.e.",",","``","attribute_error","``","is","``","True","``",")",",","then","these","flags","control","which","attributes","are","to","be","included","in","the","error","calculation",".","vectors",":","bool",",","default",":","True","See","``","scalars","``","parameter",".","normals",":","bool",",","default",":","False","See","``","scalars","``","parameter",".","tcoords",":","bool",",","default",":","True","See","``","scalars","``","parameter",".","tensors",":","bool",",","default",":","True","See","``","scalars","``","parameter",".","scalars_weight",":","float",",","default",":","0.1","The","scaling","weight","contribution","of","the","scalar","attribute",".","These","values","are","used","to","weight","the","contribution","of","the","attributes","towards","the","error","metric",".","vectors_weight",":","float",",","default",":","0.1","See","``","scalars_weight","``","parameter",".","normals_weight",":","float",",","default",":","0.1","See","``","scalars_weight","``","parameter",".","tcoords_weight",":","float",",","default",":","0.1","See","``","scalars_weight","``","parameter",".","tensors_weight",":","float",",","default",":","0.1","See","``","scalars_weight","``","parameter",".","inplace",":","bool",",","default",":","False","Whether","to","update","the","mesh","in-place",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","Returns","--","--","--","-","pyvista.PolyData","Decimated","mesh",".","Notes","--","--","-","If","you","encounter","a","segmentation","fault","or","other","error",",","consider","using",":","func",":","`","pyvista.PolyDataFilters.clean","`","to","remove","any","invalid","cells","before","using","this","filter",".","Examples","--","--","--","--","Decimate","a","sphere",".","First","plot","the","sphere",".",">",">",">","import","pyvista","as","pv",">",">",">","sphere","=","pv.Sphere","(","phi_resolution=60",",","theta_resolution=60",")",">",">",">","sphere.plot","(","show_edges=True",",","line_width=2",")","Now","decimate","it","by","75","%","and","plot","it",".",">",">",">","decimated","=","sphere.decimate","(","0.75",")",">",">",">","decimated.plot","(","show_edges=True",",","line_width=2",")","See",":","ref",":","`","decimate_example","`","for","more","examples","using","this","filter","."]
code: def decimate(
      self,
      target_reduction,
      volume_preservation=False,
      attribute_error=False,
      scalars=True,
      vectors=True,
      normals=False,
      tcoords=True,
      tensors=True,
      scalars_weight=0.1,
      vectors_weight=0.1,
      normals_weight=0.1,
      tcoords_weight=0.1,
      tensors_weight=0.1,
      inplace=False,
      progress_bar=False,
  ):
      """Reduce the number of triangles in a triangular mesh using ``vtkQuadricDecimation``.
  
      Parameters
      ----------
      target_reduction : float
          Fraction of the original mesh to remove.
          If ``target_reduction`` is set to 0.9, this filter will try
          to reduce the data set to 10% of its original size and will
          remove 90% of the input triangles.
  
      volume_preservation : bool, default: False
          Decide whether to activate volume preservation which greatly
          reduces errors in triangle normal direction. If ``False``,
          volume preservation is disabled and if ``attribute_error``
          is active, these errors can be large.
  
      attribute_error : bool, default: False
          Decide whether to include data attributes in the error metric. If
          ``False``, then only geometric error is used to control the
          decimation. If ``True``, the following flags are used to specify
          which attributes are to be included in the error calculation.
  
      scalars : bool, default: True
          If attribute errors are to be included in the metric (i.e.,
          ``attribute_error`` is ``True``), then these flags control
          which attributes are to be included in the error
          calculation.
  
      vectors : bool, default: True
          See ``scalars`` parameter.
  
      normals : bool, default: False
          See ``scalars`` parameter.
  
      tcoords : bool, default: True
          See ``scalars`` parameter.
  
      tensors : bool, default: True
          See ``scalars`` parameter.
  
      scalars_weight : float, default: 0.1
          The scaling weight contribution of the scalar attribute.
          These values are used to weight the contribution of the
          attributes towards the error metric.
  
      vectors_weight : float, default: 0.1
          See ``scalars_weight`` parameter.
  
      normals_weight : float, default: 0.1
          See ``scalars_weight`` parameter.
  
      tcoords_weight : float, default: 0.1
          See ``scalars_weight`` parameter.
  
      tensors_weight : float, default: 0.1
          See ``scalars_weight`` parameter.
  
      inplace : bool, default: False
          Whether to update the mesh in-place.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.PolyData
          Decimated mesh.
  
      Notes
      -----
      If you encounter a segmentation fault or other error, consider using
      :func:`pyvista.PolyDataFilters.clean` to remove any invalid cells
      before using this filter.
  
      Examples
      --------
      Decimate a sphere.  First plot the sphere.
  
      >>> import pyvista as pv
      >>> sphere = pv.Sphere(phi_resolution=60, theta_resolution=60)
      >>> sphere.plot(show_edges=True, line_width=2)
  
      Now decimate it by 75% and plot it.
  
      >>> decimated = sphere.decimate(0.75)
      >>> decimated.plot(show_edges=True, line_width=2)
  
      See :ref:`decimate_example` for more examples using this filter.
  
      """
      if not self.is_all_triangles:
          raise NotAllTrianglesError(
              "Input mesh for decimation must be all triangles."
          )
  
      # create decimation filter
      alg = _vtk.vtkQuadricDecimation()
  
      alg.SetVolumePreservation(volume_preservation)
      alg.SetAttributeErrorMetric(attribute_error)
      alg.SetScalarsAttribute(scalars)
      alg.SetVectorsAttribute(vectors)
      alg.SetNormalsAttribute(normals)
      alg.SetTCoordsAttribute(tcoords)
      alg.SetTensorsAttribute(tensors)
      alg.SetScalarsWeight(scalars_weight)
      alg.SetVectorsWeight(vectors_weight)
      alg.SetNormalsWeight(normals_weight)
      alg.SetTCoordsWeight(tcoords_weight)
      alg.SetTensorsWeight(tensors_weight)
      alg.SetTargetReduction(target_reduction)
  
      alg.SetInputData(self)
      _update_alg(alg, progress_bar, "Decimating Mesh")
  
      mesh = _get_output(alg)
      if inplace:
          self.copy_from(mesh, deep=False)
          return self
  
      return mesh
  
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 20 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.decimate(target_reduction, volume_preservation, attribute_error, scalars, vectors, normals, tcoords, tensors, scalars_weight, vectors_weight, normals_weight, tcoords_weight, tensors_weight, inplace, progress_bar) and returns: mesh, self