# Examples from pyvista.Transform.as_rotation
# ===========================================

# Create a rotation matrix and initialize a `Transform` from it.
import numpy as np
import pyvista as pv
matrix = [[0, -1, 0], [1, 0, 0], [0, 0, 1]]
transform = pv.Transform(matrix)

# Represent the rotation as `scipy.spatial.transform.Rotation` instance.
rot = transform.as_rotation()
type(rot)

# Represent the rotation as a quaternion.
rot = transform.as_rotation('quat')
rot

# Represent the rotation as a rotation vector. The vector has a direction
# `(0, 0, 1)` and magnitude of `pi/2`.
rot = transform.as_rotation('rotvec')
rot

# Represent the rotation as a Modified Rodrigues Parameters vector.
rot = transform.as_rotation('mrp')
rot

# Represent the rotation as x-y-z Euler angles in degrees.
rot = transform.as_rotation('euler', 'xyz', degrees=True)
rot

# Represent the rotation as extrinsic x-y-z Davenport angles in degrees.
rot = transform.as_rotation(
    'davenport', np.eye(3), 'extrinsic', degrees=True
)
rot

# ----------------------------------------------------------------------
# Generated by sphinx-examples-as-code https://github.com/pyvista/sphinx-examples-as-code

