bundles / scipy 1.18.0 / scipy / spatial / transform / _rigid_transform / RigidTransform / from_translation
staticmethod
scipy.spatial.transform._rigid_transform:RigidTransform.from_translation
Signature
staticmethod
def from_translation(translation: ArrayLike) → RigidTransformSummary
Initialize from a translation numpy array, without a rotation.
Extended Summary
When applying this transform to a vector v, the result is the same as if the translation and vector were added together. If t is the displacement vector of the translation, then:
Tf.from_translation(t).apply(v) == t + v
Parameters
translation: array_like, shape (..., 3)Translation vectors. Each translation[..., :] represents a 3D translation vector.
Returns
transform: `RigidTransform` instanceObject containing the rigid transform represented by the input translation.
Examples
from scipy.spatial.transform import RigidTransform as Tf import numpy as np✓
t = np.array([2, 3, 4]) t + np.array([1, 0, 0]) tf = Tf.from_translation(t) tf.apply([1, 0, 0]) tf.single✓
TrueThe top 3x1 points in the rightmost column of the transformation matrix is the translation vector:
tf.as_matrix() np.allclose(tf.as_matrix()[:3, 3], t)✓
TrueCreating multiple transforms from an N-dimensional array of translation vectors:
t = np.array([[2, 3, 4], [1, 0, 0]]) t + np.array([1, 0, 0]) tf = Tf.from_translation(t) tf.apply([1, 0, 0]) np.allclose(tf.as_matrix()[:, :3, 3], t) tf.single len(tf)✓
2
Aliases
scipy.spatial.transform.RigidTransform.from_translation