SciPy

This is documentation for an old release of SciPy (version 1.5.3). Read this page in the documentation of the latest stable release (version 1.15.1).

scipy.spatial.transform.Rotation.magnitude

Rotation.magnitude(self)[source]

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

Returns
magnitudendarray or float

Angle(s) in radians, float if object contains a single rotation and ndarray if object contains multiple rotations.

Examples

>>>
>>> from scipy.spatial.transform import Rotation as R
>>> r = R.from_quat(np.eye(4))
>>> r.magnitude()
array([3.14159265, 3.14159265, 3.14159265, 0.        ])

Magnitude of a single rotation:

>>>
>>> r[0].magnitude()
3.141592653589793