pyvista.DataSet.rotate_z#

DataSet.rotate_z(angle: float, point: ndarray[Any, dtype[number]] | Sequence[int | float] = (0.0, 0.0, 0.0), transform_all_input_vectors: bool = False, inplace: bool = False)[source]#

Rotate mesh about the z-axis.

Note

See also the notes at transform() which is used by this filter under the hood.

Parameters:
anglefloat

Angle in degrees to rotate about the z-axis.

pointVector, default: (0.0, 0.0, 0.0)

Point to rotate about. Defaults to origin.

transform_all_input_vectorsbool, default: False

When True, all input vectors are transformed. Otherwise, only the points, normals and active vectors are transformed.

inplacebool, default: False

Updates mesh in-place.

Returns:
pyvista.DataSet

Rotated dataset.

Examples

Rotate a mesh 30 degrees about the z-axis.

>>> import pyvista as pv
>>> mesh = pv.Cube()
>>> rot = mesh.rotate_z(30, inplace=False)

Plot the rotated mesh.

>>> pl = pv.Plotter()
>>> _ = pl.add_mesh(rot)
>>> _ = pl.add_mesh(mesh, style='wireframe', line_width=3)
>>> _ = pl.add_axes_at_origin()
>>> pl.show()
https://d33wubrfki0l68.cloudfront.net/f1c87a4d115275c25a08785e53eb78fff7f84b58/a80e9/_images/pyvista-dataset-rotate_z-1_00_00.png