scipy.spatial.transform.Rotation.
inv#
- Rotation.inv()[source]#
Invert this rotation.
Composition of a rotation with its inverse results in an identity transformation.
- Returns:
- inverse
Rotation
instance Object containing inverse of the rotations in the current instance.
- inverse
Notes
Array API Standard Support
inv
has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variableSCIPY_ARRAY_API=1
and providing CuPy, PyTorch, JAX, or Dask arrays as array arguments. The following combinations of backend and device (or other capability) are supported.Library
CPU
GPU
NumPy
✅
n/a
CuPy
n/a
✅
PyTorch
✅
✅
JAX
✅
✅
Dask
⛔
n/a
See Support for the array API standard for more information.
Examples
>>> from scipy.spatial.transform import Rotation as R >>> import numpy as np
Inverting a single rotation:
>>> p = R.from_euler('z', 45, degrees=True) >>> q = p.inv() >>> q.as_euler('zyx', degrees=True) array([-45., 0., 0.])
Inverting multiple rotations:
>>> p = R.from_rotvec([[0, 0, np.pi/3], [-np.pi/4, 0, 0]]) >>> q = p.inv() >>> q.as_rotvec() array([[-0. , -0. , -1.04719755], [ 0.78539816, -0. , -0. ]])