bundles / scipy latest / scipy / spatial / transform / _rotation / Rotation / from_euler
staticmethod
scipy.spatial.transform._rotation:Rotation.from_euler
Signature
def from_euler ( seq : str , angles : ArrayLike , degrees : bool = False ) → Rotation Summary
Initialize from Euler angles.
Extended Summary
Rotations in 3-D can be represented by a sequence of 3 rotations around a sequence of axes. In theory, any three axes spanning the 3-D Euclidean space are enough. In practice, the axes of rotation are chosen to be the basis vectors.
The three rotations can either be in a global frame of reference (extrinsic) or in a body centred frame of reference (intrinsic), which is attached to, and moves with, the object under rotation [1].
Parameters
seq: stringSpecifies sequence of axes for rotations. Up to 3 characters belonging to the set {'X', 'Y', 'Z'} for intrinsic rotations, or {'x', 'y', 'z'} for extrinsic rotations. Extrinsic and intrinsic rotations cannot be mixed in one function call.
angles: float or array_like, shape (..., [1 or 2 or 3])Euler angles specified in radians (
degreesis False) or degrees (degreesis True). Each character inseqdefines one axis around whichanglesturns. The resulting rotation has the shape np.atleast_1d(angles).shape[:-1]. Dimensionless angles are thus only valid for single characterseq.degrees: bool, optionalIf True, then the given angles are assumed to be in degrees. Default is False.
Returns
rotation: `Rotation` instanceObject containing the rotation represented by the sequence of rotations around given axes with given angles.
Notes
Array API Standard Support
from_euler 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
✓r = R.from_euler('x', 90, degrees=True) r.as_quat().shape✓
r = R.from_euler('zyx', [90, 45, 30], degrees=True) r.as_quat().shape✓
r = R.from_euler('x', [[90]], degrees=True) r.as_quat().shape✓
r = R.from_euler('zyx', [[90, 45, 30]], degrees=True) r.as_quat().shape✓
r = R.from_euler('x', [[90], [45], [30]], degrees=True) r.as_quat().shape✓
r = R.from_euler('zyx', [[90, 45, 30], [35, 45, 90]], degrees=True) r.as_quat().shape✓
Aliases
-
scipy.spatial.transform.Rotation.from_euler