PolyDataFilters.flip_normal_vectors#
- PolyDataFilters.flip_normal_vectors( ) 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 withcompute_normals()and enabling theflip_normalsoption.Added in version 0.45.
- Parameters:
- Returns:
pyvista.PolyDataMesh 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_facesFlip the orientation of the faces.
pyvista.PolyDataFilters.compute_normalsCompute new normals. Includes the option to flip the normals.
pyvista.PolyData.point_normalsReturns the array of point normals.
pyvista.PolyData.cell_normalsReturns the array of cell normals.