bundles / scipy 1.18.0 / scipy / spatial / transform / _rigid_transform / RigidTransform / from_components
staticmethod
scipy.spatial.transform._rigid_transform:RigidTransform.from_components
Signature
def from_components(translation: ArrayLike, rotation: Rotation) → RigidTransformSummary
Initialize a rigid transform from translation and rotation components.
Extended Summary
When creating a rigid transform from a translation and rotation, the translation is applied after the rotation, such that tf = Tf.from_components(translation, rotation) is equivalent to tf = Tf.from_translation(translation) * Tf.from_rotation(rotation).
When applying a transform to a vector v, the result is the same as if the transform was applied to the vector in the following way: tf.apply(v) == translation + rotation.apply(v)
Parameters
translation: array_like, shape (..., 3)Translation vectors. Each translation[..., :] represents a 3D translation vector.
rotation: `Rotation` instanceRotation objects. The shape must be broadcastable with the translation shape.
Returns
transform: `RigidTransform` instanceRigid transform objects. The shape is determined by broadcasting the translation and rotation shapes together.
Examples
from scipy.spatial.transform import RigidTransform as Tf from scipy.spatial.transform import Rotation as R import numpy as np✓
t = np.array([2, 3, 4]) r = R.from_euler("ZYX", [90, 30, 0], degrees=True)✓
r.as_matrix()
✗array([[ 0. , -1. , 0. ],
[ 0.86603, 0. , 0.5 ],
[-0.5 , 0. , 0.86603]])
tf = Tf.from_components(t, r)
✓tf.rotation.as_matrix()
✗array([[ 0. , -1. , 0. ],
[ 0.86603, 0. , 0.5 ],
[-0.5 , 0. , 0.86603]])
tf.translation tf.single✓
TrueWhen applying a transform to a vector ``v``, the result is the same as if the transform was applied to the vector in the following way: ``tf.apply(v) == translation + rotation.apply(v)``
r.apply([1, 0, 0]) t + r.apply([1, 0, 0]) tf.apply([1, 0, 0])✗
array([2. , 3.86603, 3.5 ])
Aliases
scipy.spatial.transform.RigidTransform.from_components