{ } Raw JSON

bundles / scipy 1.18.0 / scipy / spatial / transform / _rotation / Rotation / magnitude

function

scipy.spatial.transform._rotation:Rotation.magnitude

source: /scipy/spatial/transform/_rotation.py:1916

Signature

def magnitude(self) → Array

Summary

Get the magnitude(s) of the rotation(s).

Returns

magnitude : ndarray or float

Angle(s) in radians, float if object contains a single rotation and ndarray if object contains ND rotations. The magnitude will always be in the range [0, pi].

Examples

from scipy.spatial.transform import Rotation as R
import numpy as np
r = R.from_quat(np.eye(4))
✓
r.as_quat()
r.magnitude()
✗
array([3.14159, 3.14159, 3.14159, 0.     ])
Magnitude of a single rotation:
r[0].magnitude()
✗
np.float64(3.141592653589793)

Aliases

  • scipy.spatial.transform.Rotation.magnitude