- PolyData.compute_normals(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 Gouraud shading).
Calculation of cell normals. Defaults to
Calculation of point normals. Defaults to
Splitting of sharp edges. Defaults to
Set global flipping of normal orientation. Flipping modifies both the normal direction and the order of a cell’s points. Defaults to
Enforcement of consistent polygon ordering. Defaults to
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_normalsflag. However, this flag can work with the
flip_normalsflag, and if both are set, all the normals in the output will point “inward”. Defaults to
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. Defaults to
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”. Defaults to 30.0.
Updates mesh in-place. Defaults to
Display a progress bar to indicate progress.
Updated mesh with cell and point normals.
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.
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 Computing Surface Normals for more examples using this filter.