pyvista.Prop3D.rotation_from

pyvista.Prop3D.rotation_from#

Prop3D.rotation_from(rotation: pyvista.RotationLike)[source]#

Set the entity’s orientation from a rotation.

Set the rotation of this entity from a 3x3 rotation matrix. This includes NumPy arrays, a vtkMatrix3x3, and SciPy Rotation objects.

This method may be used as an alternative for setting the orientation.

Parameters:
rotationRotationLike

3x3 rotation matrix or a SciPy Rotation object.

Examples

Create an actor and show its initial orientation.

>>> import pyvista as pv
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(pv.Sphere())
>>> actor.orientation
(0.0, -0.0, 0.0)

Set the orientation using a 3x3 matrix.

>>> actor.rotation_from([[0, 1, 0], [1, 0, 0], [0, 0, 1]])
>>> actor.orientation
(0.0, -180.0, -89.99999999999999)
../../../_images/pyvista-Prop3D-rotation_from-1_00_00.png