pyvista.Transform.rotate_x#
- Transform.rotate_x(
- angle: float,
- *,
- point: VectorLike[float] | None = None,
- multiply_mode: Literal['pre', 'post'] | None = None,
Concatenate a rotation about the x-axis.
Create a matrix for rotation about the x-axis and
concatenate()
it with the current transformationmatrix
according 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 x-axis.
- point
VectorLike
[float
],optional
Point to rotate about. By default, the object’s
point
is used, but this can be overridden. If set, two additional transformations are concatenated and added to thematrix_list
:translate()
topoint
before the rotationtranslate()
away frompoint
after the rotation
- multiply_mode‘pre’ | ‘post’,
optional
Multiplication mode to use when concatenating the matrix. By default, the object’s
multiply_mode
is used, but this can be overridden. Set this to'pre'
for pre-multiplication or'post'
for post-multiplication.
- angle
See also
pyvista.DataSet.rotate_x
Rotate a mesh about the x-axis.
Examples
Concatenate a rotation about the x-axis.
>>> import pyvista as pv >>> transform = pv.Transform().rotate_x(90) >>> transform.matrix array([[ 1., 0., 0., 0.], [ 0., 0., -1., 0.], [ 0., 1., 0., 0.], [ 0., 0., 0., 1.]])
Concatenate a second rotation about the x-axis.
>>> _ = transform.rotate_x(45)
The result is a matrix that rotates about the x-axis by 135 degrees.
>>> transform.matrix array([[ 1. , 0. , 0. , 0. ], [ 0. , -0.70710678, -0.70710678, 0. ], [ 0. , 0.70710678, -0.70710678, 0. ], [ 0. , 0. , 0. , 1. ]])