scipy.spatial.transform.Rotation.mean¶
-
Rotation.
mean
(self, weights=None)[source]¶ Get the mean of the rotations.
- Parameters
- 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.
- Returns
- mean
Rotation
instance Object containing the mean of the rotations in the current instance.
- mean
Notes
The mean used is the chordal L2 mean (also called the projected or induced arithmetic mean). If
p
is a set of rotations with meanm
, thenm
is the rotation which minimizes(weights[:, None, None] * (p.as_matrix() - m.as_matrix())**2).sum()
.Examples
>>> 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])