bundles / scipy 1.18.0 / scipy / spatial / transform / _rigid_transform / RigidTransform / from_rotation
staticmethod
scipy.spatial.transform._rigid_transform:RigidTransform.from_rotation
Signature
staticmethod
def from_rotation(rotation: Rotation) → RigidTransformSummary
Initialize from a rotation, without a translation.
Extended Summary
When applying this transform to a vector v, the result is the same as if the rotation was applied to the vector. Tf.from_rotation(r).apply(v) == r.apply(v)
Parameters
rotation: `Rotation` instanceA single rotation or a rotation with N leading dimensions.
Returns
transform: `RigidTransform` instanceObject containing the rigid transform represented by the input rotation.
Examples
from scipy.spatial.transform import RigidTransform as Tf from scipy.spatial.transform import Rotation as R import numpy as np✓
r = R.from_euler("ZYX", [90, 30, 0], degrees=True)
✓r.apply([1, 0, 0])
✗array([ 0. , 0.86603, -0.5 ])
tf = Tf.from_rotation(r)
✓tf.apply([1, 0, 0])
✗array([ 0. , 0.86603, -0.5 ])
tf.single
✓TrueThe upper 3x3 submatrix of the transformation matrix is the rotation matrix:
np.allclose(tf.as_matrix()[:3, :3], r.as_matrix(), atol=1e-12)
✓TrueCreating multiple transforms from a rotation with N leading dimensions:
r = R.from_euler("ZYX", [[90, 30, 0], [45, 30, 60]], degrees=True)
✓r.apply([1, 0, 0])
✗array([[ 0. , 0.86603, -0.5 ],
[ 0.61237, 0.61237, -0.5 ]])
tf = Tf.from_rotation(r)
✓tf.apply([1, 0, 0])
✗array([[ 0. , 0.86603, -0.5 ],
[ 0.61237, 0.61237, -0.5 ]])
tf.single len(tf)✓
2
Aliases
scipy.spatial.transform.RigidTransform.from_rotation