bundles / scipy latest / scipy / spatial / transform / _rotation / Rotation / from_rotvec
staticmethod
scipy.spatial.transform._rotation:Rotation.from_rotvec
Signature
def from_rotvec ( rotvec : ArrayLike , degrees : bool = False ) → Rotation Summary
Initialize from rotation vectors.
Extended Summary
A rotation vector is a 3 dimensional vector which is co-directional to the axis of rotation and whose norm gives the angle of rotation [1].
Parameters
rotvec: array_like, shape (..., 3)A single vector or an ND array of vectors, where the last dimension contains the rotation vectors.
degrees: bool, optionalIf True, then the given magnitudes are assumed to be in degrees. Default is False.
Returns
rotation: `Rotation` instanceObject containing the rotations represented by input rotation vectors.
Notes
Array API Standard Support
from_rotvec has experimental support for Python Array API Standard compatible backends in addition to NumPy. Please consider testing these features by setting an environment variable SCIPY_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
dev-arrayapifor more information.
Examples
from scipy.spatial.transform import Rotation as R import numpy as np✓
r = R.from_rotvec(np.pi/2 * np.array([0, 0, 1]))
✓r.as_rotvec()
✗r.as_rotvec().shape
✓r = R.from_rotvec(45 * np.array([0, 1, 0]), degrees=True) r.as_rotvec(degrees=True)✓
r = R.from_rotvec([ [0, 0, np.pi/2], [np.pi/2, 0, 0]])✓
r.as_rotvec()
✗r.as_rotvec().shape
✓r = R.from_rotvec([[0, 0, np.pi/2]]) r.as_rotvec().shape✓
Aliases
-
scipy.spatial.transform.Rotation.from_rotvec