This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / spatial / transform / _rotation / Rotation / as_mrp

function

scipy.spatial.transform._rotation:Rotation.as_mrp

source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/transform/_rotation.py:1454

Signature

def as_mrp(self) → Array

Summary

Represent as Modified Rodrigues Parameters (MRPs).

Extended Summary

MRPs are a 3 dimensional vector co-directional to the axis of rotation and whose magnitude is equal to tan(theta / 4), where theta is the angle of rotation (in radians) [1].

MRPs have a singularity at 360 degrees which can be avoided by ensuring the angle of rotation does not exceed 180 degrees, i.e. switching the direction of the rotation when it is past 180 degrees. This function will always return MRPs corresponding to a rotation of less than or equal to 180 degrees.

Returns

mrps : ndarray, shape (..., 3)

Shape depends on shape of inputs used for initialization.

Notes

Examples

from scipy.spatial.transform import Rotation as R
import numpy as np
✓
Represent a single rotation:
r = R.from_rotvec([0, 0, np.pi])
✓
r.as_mrp()
✗
array([0., 0., 1.])
r.as_mrp().shape
✓
(3,)
Represent a stack with a single rotation:
r = R.from_euler('xyz', [[180, 0, 0]], degrees=True)
✓
r.as_mrp()
✗
array([[1., 0., 0.]])
r.as_mrp().shape
✓
(1, 3)
Represent multiple rotations:
r = R.from_rotvec([[np.pi/2, 0, 0], [0, 0, np.pi/2]])
✓
r.as_mrp()
✗
array([[0.41421, 0.     , 0.     ],
       [0.     , 0.     , 0.41421]])
r.as_mrp().shape
✓
(2, 3)

Aliases

  • scipy.spatial.transform.Rotation.as_mrp