pyvista.Transform.rotation_matrix

pyvista.Transform.rotation_matrix#

property Transform.rotation_matrix: NumpyArray[float][source]#

Return the rotation component of the current transformation matrix as a 3x3 matrix.

The rotation is orthonormal and right-handed with positive determinant.

Added in version 0.47.

Examples

Compose a rotation about the z-axis.

>>> import pyvista as pv
>>> trans = pv.Transform().rotate_z(90)

Get the rotation matrix.

>>> trans.rotation_matrix
array([[ 0., -1.,  0.],
       [ 1.,  0.,  0.],
       [ 0.,  0.,  1.]])

Compose a second rotation and get the rotation matrix again.

>>> _ = trans.rotate_y(-90)
>>> trans.rotation_matrix
array([[ 0.,  0., -1.],
       [ 1.,  0.,  0.],
       [ 0., -1.,  0.]])