Rotation.mean(self, weights=None)#

Get the mean of the rotations.

weightsarray_like shape (N,), optional

Weights describing the relative importance of the rotations. If None (default), then all values in weights are assumed to be equal.

meanRotation instance

Object containing the mean of the rotations in the current instance.


The mean used is the chordal L2 mean (also called the projected or induced arithmetic mean). If p is a set of rotations with mean m, then m is the rotation which minimizes (weights[:, None, None] * (p.as_matrix() - m.as_matrix())**2).sum().


>>> from scipy.spatial.transform import Rotation as R
>>> r = R.from_euler('zyx', [[0, 0, 0],
...                          [1, 0, 0],
...                          [0, 1, 0],
...                          [0, 0, 1]], degrees=True)
>>> r.mean().as_euler('zyx', degrees=True)
array([0.24945696, 0.25054542, 0.24945696])