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: Compute point and/or cell normals for a mesh.
  
  The filter can reorder polygons to insure consistent
  orientation across polygon neighbors. Sharp edges can be split
  and points duplicated with separate normals to give crisp
  (rendered) surface definition. It is also possible to globally
  flip the normal orientation.
  
  The algorithm works by determining normals for each polygon
  and then averaging them at shared points. When sharp edges are
  present, the edges are split and new points generated to
  prevent blurry edges (due to Phong shading).
  
  Parameters
  ----------
  cell_normals : bool, default: True
      Calculation of cell normals.
  
  point_normals : bool, default: True
      Calculation of point normals.
  
  split_vertices : bool, default: False
      Splitting of sharp edges. Indices to the original points are
      tracked in the ``"pyvistaOriginalPointIds"`` array.
  
  flip_normals : bool, default: False
      Set global flipping of normal orientation. Flipping
      modifies both the normal direction and the order of a
      cell's points.
  
  consistent_normals : bool, default: True
      Enforcement of consistent polygon ordering.
  
  auto_orient_normals : bool, default: False
      Turn on/off the automatic determination of correct normal
      orientation. NOTE: This assumes a completely closed
      surface (i.e. no boundary edges) and no non-manifold
      edges. If these constraints do not hold, all bets are
      off. This option adds some computational complexity, and
      is useful if you do not want to have to inspect the
      rendered image to determine whether to turn on the
      ``flip_normals`` flag.  However, this flag can work with
      the ``flip_normals`` flag, and if both are set, all the
      normals in the output will point "inward".
  
  non_manifold_traversal : bool, default: True
      Turn on/off traversal across non-manifold edges. Changing
      this may prevent problems where the consistency of
      polygonal ordering is corrupted due to topological
      loops.
  
  feature_angle : float, default: 30.0
      The angle that defines a sharp edge. If the difference in
      angle across neighboring polygons is greater than this
      value, the shared edge is considered "sharp".
  
  inplace : bool, default: False
      Updates mesh in-place.
  
  progress_bar : bool, default: False
      Display a progress bar to indicate progress.
  
  Returns
  -------
  pyvista.PolyData
      Updated mesh with cell and point normals.
  
  Notes
  -----
  Previous arrays named ``"Normals"`` will be overwritten.
  
  Normals are computed only for polygons and triangle
  strips. Normals are not computed for lines or vertices.
  
  Triangle strips are broken up into triangle polygons. You may
  want to restrip the triangles.
  
  It may be easier to run
  :func:`pyvista.PolyData.point_normals` or
  :func:`pyvista.PolyData.cell_normals` if you would just
  like the array of point or cell normals.
  
  Examples
  --------
  Compute the point normals of the surface of a sphere.
  
  >>> import pyvista as pv
  >>> sphere = pv.Sphere()
  >>> sphere = sphere.compute_normals(cell_normals=False)
  >>> normals = sphere['Normals']
  >>> normals.shape
  (842, 3)
  
  Alternatively, create a new mesh when computing the normals
  and compute both cell and point normals.
  
  >>> import pyvista as pv
  >>> sphere = pv.Sphere()
  >>> sphere_with_norm = sphere.compute_normals()
  >>> sphere_with_norm.point_data['Normals'].shape
  (842, 3)
  >>> sphere_with_norm.cell_data['Normals'].shape
  (1680, 3)
  
  See :ref:`surface_normal_example` for more examples using this filter.
docstr_tok: ["Compute","point","and\/or","cell","normals","for","a","mesh",".","The","filter","can","reorder","polygons","to","insure","consistent","orientation","across","polygon","neighbors",".","Sharp","edges","can","be","split","and","points","duplicated","with","separate","normals","to","give","crisp","(","rendered",")","surface","definition",".","It","is","also","possible","to","globally","flip","the","normal","orientation",".","The","algorithm","works","by","determining","normals","for","each","polygon","and","then","averaging","them","at","shared","points",".","When","sharp","edges","are","present",",","the","edges","are","split","and","new","points","generated","to","prevent","blurry","edges","(","due","to","Phong","shading",")",".","Parameters","--","--","--","--","--","cell_normals",":","bool",",","default",":","True","Calculation","of","cell","normals",".","point_normals",":","bool",",","default",":","True","Calculation","of","point","normals",".","split_vertices",":","bool",",","default",":","False","Splitting","of","sharp","edges",".","Indices","to","the","original","points","are","tracked","in","the","``","``","pyvistaOriginalPointIds","''","``","array",".","flip_normals",":","bool",",","default",":","False","Set","global","flipping","of","normal","orientation",".","Flipping","modifies","both","the","normal","direction","and","the","order","of","a","cell","'s","points",".","consistent_normals",":","bool",",","default",":","True","Enforcement","of","consistent","polygon","ordering",".","auto_orient_normals",":","bool",",","default",":","False","Turn","on\/off","the","automatic","determination","of","correct","normal","orientation",".","NOTE",":","This","assumes","a","completely","closed","surface","(","i.e",".","no","boundary","edges",")","and","no","non-manifold","edges",".","If","these","constraints","do","not","hold",",","all","bets","are","off",".","This","option","adds","some","computational","complexity",",","and","is","useful","if","you","do","not","want","to","have","to","inspect","the","rendered","image","to","determine","whether","to","turn","on","the","``","flip_normals","``","flag",".","However",",","this","flag","can","work","with","the","``","flip_normals","``","flag",",","and","if","both","are","set",",","all","the","normals","in","the","output","will","point","``","inward","''",".","non_manifold_traversal",":","bool",",","default",":","True","Turn","on\/off","traversal","across","non-manifold","edges",".","Changing","this","may","prevent","problems","where","the","consistency","of","polygonal","ordering","is","corrupted","due","to","topological","loops",".","feature_angle",":","float",",","default",":","30.0","The","angle","that","defines","a","sharp","edge",".","If","the","difference","in","angle","across","neighboring","polygons","is","greater","than","this","value",",","the","shared","edge","is","considered","``","sharp","''",".","inplace",":","bool",",","default",":","False","Updates","mesh","in-place",".","progress_bar",":","bool",",","default",":","False","Display","a","progress","bar","to","indicate","progress",".","Returns","--","--","--","-","pyvista.PolyData","Updated","mesh","with","cell","and","point","normals",".","Notes","--","--","-","Previous","arrays","named","``","``","Normals","''","``","will","be","overwritten",".","Normals","are","computed","only","for","polygons","and","triangle","strips",".","Normals","are","not","computed","for","lines","or","vertices",".","Triangle","strips","are","broken","up","into","triangle","polygons",".","You","may","want","to","restrip","the","triangles",".","It","may","be","easier","to","run",":","func",":","`","pyvista.PolyData.point_normals","`","or",":","func",":","`","pyvista.PolyData.cell_normals","`","if","you","would","just","like","the","array","of","point","or","cell","normals",".","Examples","--","--","--","--","Compute","the","point","normals","of","the","surface","of","a","sphere",".",">",">",">","import","pyvista","as","pv",">",">",">","sphere","=","pv.Sphere","(",")",">",">",">","sphere","=","sphere.compute_normals","(","cell_normals=False",")",">",">",">","normals","=","sphere","[","'Normals","'","]",">",">",">","normals.shape","(","842",",","3",")","Alternatively",",","create","a","new","mesh","when","computing","the","normals","and","compute","both","cell","and","point","normals",".",">",">",">","import","pyvista","as","pv",">",">",">","sphere","=","pv.Sphere","(",")",">",">",">","sphere_with_norm","=","sphere.compute_normals","(",")",">",">",">","sphere_with_norm.point_data","[","'Normals","'","]",".shape","(","842",",","3",")",">",">",">","sphere_with_norm.cell_data","[","'Normals","'","]",".shape","(","1680",",","3",")","See",":","ref",":","`","surface_normal_example","`","for","more","examples","using","this","filter","."]
code: def compute_normals(
      self,
      cell_normals=True,
      point_normals=True,
      split_vertices=False,
      flip_normals=False,
      consistent_normals=True,
      auto_orient_normals=False,
      non_manifold_traversal=True,
      feature_angle=30.0,
      inplace=False,
      progress_bar=False,
  ):
      """Compute point and/or cell normals for a mesh.
  
      The filter can reorder polygons to insure consistent
      orientation across polygon neighbors. Sharp edges can be split
      and points duplicated with separate normals to give crisp
      (rendered) surface definition. It is also possible to globally
      flip the normal orientation.
  
      The algorithm works by determining normals for each polygon
      and then averaging them at shared points. When sharp edges are
      present, the edges are split and new points generated to
      prevent blurry edges (due to Phong shading).
  
      Parameters
      ----------
      cell_normals : bool, default: True
          Calculation of cell normals.
  
      point_normals : bool, default: True
          Calculation of point normals.
  
      split_vertices : bool, default: False
          Splitting of sharp edges. Indices to the original points are
          tracked in the ``"pyvistaOriginalPointIds"`` array.
  
      flip_normals : bool, default: False
          Set global flipping of normal orientation. Flipping
          modifies both the normal direction and the order of a
          cell's points.
  
      consistent_normals : bool, default: True
          Enforcement of consistent polygon ordering.
  
      auto_orient_normals : bool, default: False
          Turn on/off the automatic determination of correct normal
          orientation. NOTE: This assumes a completely closed
          surface (i.e. no boundary edges) and no non-manifold
          edges. If these constraints do not hold, all bets are
          off. This option adds some computational complexity, and
          is useful if you do not want to have to inspect the
          rendered image to determine whether to turn on the
          ``flip_normals`` flag.  However, this flag can work with
          the ``flip_normals`` flag, and if both are set, all the
          normals in the output will point "inward".
  
      non_manifold_traversal : bool, default: True
          Turn on/off traversal across non-manifold edges. Changing
          this may prevent problems where the consistency of
          polygonal ordering is corrupted due to topological
          loops.
  
      feature_angle : float, default: 30.0
          The angle that defines a sharp edge. If the difference in
          angle across neighboring polygons is greater than this
          value, the shared edge is considered "sharp".
  
      inplace : bool, default: False
          Updates mesh in-place.
  
      progress_bar : bool, default: False
          Display a progress bar to indicate progress.
  
      Returns
      -------
      pyvista.PolyData
          Updated mesh with cell and point normals.
  
      Notes
      -----
      Previous arrays named ``"Normals"`` will be overwritten.
  
      Normals are computed only for polygons and triangle
      strips. Normals are not computed for lines or vertices.
  
      Triangle strips are broken up into triangle polygons. You may
      want to restrip the triangles.
  
      It may be easier to run
      :func:`pyvista.PolyData.point_normals` or
      :func:`pyvista.PolyData.cell_normals` if you would just
      like the array of point or cell normals.
  
      Examples
      --------
      Compute the point normals of the surface of a sphere.
  
      >>> import pyvista as pv
      >>> sphere = pv.Sphere()
      >>> sphere = sphere.compute_normals(cell_normals=False)
      >>> normals = sphere['Normals']
      >>> normals.shape
      (842, 3)
  
      Alternatively, create a new mesh when computing the normals
      and compute both cell and point normals.
  
      >>> import pyvista as pv
      >>> sphere = pv.Sphere()
      >>> sphere_with_norm = sphere.compute_normals()
      >>> sphere_with_norm.point_data['Normals'].shape
      (842, 3)
      >>> sphere_with_norm.cell_data['Normals'].shape
      (1680, 3)
  
      See :ref:`surface_normal_example` for more examples using this filter.
  
      """
      # track original point indices
      if split_vertices:
          self.point_data.set_array(
              np.arange(self.n_points, dtype=pyvista.ID_TYPE),
              "pyvistaOriginalPointIds",
          )
  
      normal = _vtk.vtkPolyDataNormals()
      normal.SetComputeCellNormals(cell_normals)
      normal.SetComputePointNormals(point_normals)
      normal.SetSplitting(split_vertices)
      normal.SetFlipNormals(flip_normals)
      normal.SetConsistency(consistent_normals)
      normal.SetAutoOrientNormals(auto_orient_normals)
      normal.SetNonManifoldTraversal(non_manifold_traversal)
      normal.SetFeatureAngle(feature_angle)
      normal.SetInputData(self)
      _update_alg(normal, progress_bar, "Computing Normals")
  
      mesh = _get_output(normal)
      if point_normals:
          mesh.GetPointData().SetActiveNormals("Normals")
      if cell_normals:
          mesh.GetCellData().SetActiveNormals("Normals")
  
      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 21 for calling the PolyDataFilters obj's underlying member method code with example usage: obj.compute_normals(cell_normals, point_normals, split_vertices, flip_normals, consistent_normals, auto_orient_normals, non_manifold_traversal, feature_angle, inplace, progress_bar) and returns: mesh, self