Transform.rotate_z#
- Transform.rotate_z(
- angle: float,
- *,
- point: VectorLike[float] | None = None,
- multiply_mode: Literal['pre', 'post'] | None = None,
Compose a rotation about the z-axis.
Create a matrix for rotation about the z-axis and
compose()it with the current transformationmatrixaccording to pre-multiply or post-multiply semantics.Internally, the matrix is stored in the
matrix_list.- Parameters:
- angle
float Angle in degrees to rotate about the z-axis.
- point
VectorLike[float],optional Point to rotate about. By default, the object’s
pointis used, but this can be overridden. If set, two additional transformations are composed and added to thematrix_list:translate()topointbefore the rotationtranslate()away frompointafter the rotation
- multiply_mode‘pre’ | ‘post’,
optional Multiplication mode to use when composing the matrix. By default, the object’s
multiply_modeis used, but this can be overridden. Set this to'pre'for pre-multiplication or'post'for post-multiplication.
- angle
See also
rotate_x,rotate_y,rotate_vector,rotateSimilar rotation methods.
rotation_matrix,rotation_axis_angle,as_rotation,has_rotationGet this transform’s rotation component.
pyvista.DataObjectFilters.rotate_zRotate a mesh about the z-axis.
Examples#
Download Python source code | Download Jupyter notebook
Compose a rotation about the z-axis.
>>> import pyvista as pv
>>> transform = pv.Transform().rotate_z(90)
>>> transform.matrix
array([[ 0., -1., 0., 0.],
[ 1., 0., 0., 0.],
[ 0., 0., 1., 0.],
[ 0., 0., 0., 1.]])
Compose a second rotation about the z-axis.
>>> _ = transform.rotate_z(45)
The result is a matrix that rotates about the z-axis by 135 degrees.
>>> transform.matrix
array([[-0.70710678, -0.70710678, 0. , 0. ],
[ 0.70710678, -0.70710678, 0. , 0. ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]])