bundles / scipy 1.18.0 / scipy / spatial / transform / _rigid_transform / RigidTransform / inv
function
scipy.spatial.transform._rigid_transform:RigidTransform.inv
Signature
def inv(self) → RigidTransformSummary
Invert this transform.
Extended Summary
Composition of a transform with its inverse results in an identity transform.
A rigid transform is a composition of a rotation and a translation, where the rotation is applied first, followed by the translation. So the inverse transform is equivalent to the inverse translation followed by the inverse rotation.
Returns
: `RigidTransform` instanceThe inverse of this transform.
Examples
from scipy.spatial.transform import RigidTransform as Tf from scipy.spatial.transform import Rotation as R import numpy as np✓
rng = np.random.default_rng(seed=123) t = rng.random(3) r = R.random(rng=rng) tf = Tf.from_components(t, r)✓
tf.as_matrix()
✗array([[-0.45431, 0.67276, -0.58394, 0.68235],
[-0.23272, 0.54311, 0.80677, 0.05382],
[ 0.85991, 0.50242, -0.09017, 0.22036],
[ 0. , 0. , 0. , 1. ]])
(tf.inv() * tf).as_matrix()
✗array([[1., 0., 0., 0.],
[0., 1., 0., 0.],
[0., 0., 1., 0.],
[0., 0., 0., 1.]])
The inverse rigid transform is the same as the inverse translation
followed by the inverse rotation:
t, r = tf.as_components() r_inv = r.inv() # inverse rotation t_inv = -t # inverse translation tf_r_inv = Tf.from_rotation(r_inv) tf_t_inv = Tf.from_translation(t_inv) np.allclose((tf_r_inv * tf_t_inv).as_matrix(), tf.inv().as_matrix(), atol=1e-12)✓
True
(tf_r_inv * tf_t_inv * tf).as_matrix()
✗array([[ 1., -0., 0., 0.],
[ 0., 1., 0., 0.],
[-0., -0., 1., 0.],
[ 0., 0., 0., 1.]])
Aliases
scipy.spatial.transform.RigidTransform.inv