PolyDataFilters.flip_normal_vectors

PolyDataFilters.flip_normal_vectors#

PolyDataFilters.flip_normal_vectors(
*,
inplace: bool = False,
progress_bar: bool = False,
) → PolyData[source]#

Flip the direction of the mesh’s point and cell normal vectors.

This filter effectively multiplies the point and cell normals by -1. It has no effect if no active normals are currently set.

Note

Polygon cells have an implicitly defined orientation which may differ from the orientation of the normal vectors. To ensure that the normals are consistent with this implicit definition, consider also using flip_faces() or re-computing normals with compute_normals() and enabling the flip_normals option.

Added in version 0.45.

Parameters:
inplacebool, default: False

Overwrites the original mesh in-place.

progress_barbool, default: False

Display a progress bar to indicate progress.

Returns:
pyvista.PolyData

Mesh with point and cell normal directions flipped.

Examples#

Download Python source code | Download Jupyter notebook

Flip the normal vectors of a sphere. Show one of the normal vectors before and after the flip.

>>> import pyvista as pv
>>> sphere = pv.Sphere()
>>> sphere.point_data['Normals'][0]
pyvista_ndarray([0., 0., 1.], dtype=float32)
>>> sphere_flipped = sphere.flip_normal_vectors()
>>> sphere_flipped.point_data['Normals'][0]
pyvista_ndarray([-0., -0., -1.], dtype=float32)

Note that the sphere’s cell ordering has not been affected by this filter.

>>> sphere.regular_faces[0]
array([ 2, 30,  0]...)
>>> sphere_flipped.regular_faces[0]
array([ 2, 30,  0]...)

See Also#

pyvista.PolyDataFilters.flip_faces

Flip the orientation of the faces.

pyvista.PolyDataFilters.compute_normals

Compute new normals. Includes the option to flip the normals.

pyvista.PolyData.point_normals

Returns the array of point normals.

pyvista.PolyData.cell_normals

Returns the array of cell normals.