bundles / scipy latest / scipy / spatial / transform / _rotation / Rotation / as_matrix
function
scipy.spatial.transform._rotation:Rotation.as_matrix
source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/transform/_rotation.py:1092
Signature
def as_matrix(self) → ArraySummary
Represent as rotation matrix.
Extended Summary
3D rotations can be represented using rotation matrices, which are 3 x 3 real orthogonal matrices with determinant equal to +1 [1].
Returns
matrix: ndarray, shape (..., 3)Shape depends on shape of inputs used for initialization.
Notes
This function was called as_dcm before.
Examples
from scipy.spatial.transform import Rotation as R import numpy as np✓
r = R.from_rotvec([0, 0, np.pi/2])
✓r.as_matrix()
✗array([[ 0., -1., 0.],
[ 1., 0., 0.],
[ 0., 0., 1.]])
r.as_matrix().shape
✓(3, 3)Represent a stack with a single rotation:
r = R.from_quat([[1, 1, 0, 0]]) r.as_matrix() r.as_matrix().shape✓
(1, 3, 3)Represent multiple rotations:
r = R.from_rotvec([[np.pi/2, 0, 0], [0, 0, np.pi/2]])
✓r.as_matrix()
✗array([[[ 1., 0., 0.],
[ 0., 0., -1.],
[ 0., 1., 0.]],
[[ 0., -1., 0.],
[ 1., 0., 0.],
[ 0., 0., 1.]]])
r.as_matrix().shape
✓(2, 3, 3)
Aliases
scipy.spatial.transform.Rotation.as_matrix