rigid_body_motion.qmean

rigid_body_motion.qmean(q, axis=None, qaxis=- 1)[source]

Quaternion mean.

Adapted from https://github.com/christophhagen/averaging-quaternions.

Parameters
q: array_like

Array containing quaternions whose mean is to be computed. Its dtype can be quaternion, otherwise qaxis specifies the axis representing the quaternions.

axis: None or int or tuple of ints, optional

Axis or axes along which the means are computed. The default is to compute the mean of the flattened array.

qaxis: int, default -1

If q is not quaternion dtype, axis of the quaternion array representing the coordinates of the quaternions.

Returns
qm: ndarray

A new array containing the mean values.