Rotations in 3D are inherently non-commutative, so whenever you work with multiple axes, the order matters. Interpolating between two rotations is a special case because you're not actually rotating the rotation operators themselves.
Rotations in 3D are inherently non-commutative, so whenever you work with multiple axes, the order matters. Interpolating between two rotations is a special case because you're not actually rotating the rotation operators themselves.
It works when doing LERPs (linear interpolations) but the algorithm above uses SLERPs (spherical interpolations) which can be expressed with quaternion products/exponentials/logarithms, so I think the order does matter.
A quick numerical check with 3 quaternions and uniform weights seems to confirm this.
Wikipedia[1] lists some equivalent formulas for quaternion slerp:
slerp(q0, q1, t) = (q0 * q1^(-1))^(1-t) * q1
slerp(q0, q1, t) = (q1 * q0^(-1))^t * q0
There you can see that quaternion products are used, yes, but the operation is also commutative, when using (1-t) instead of t.When the order in online average computation is different, the t naturally adapts to the correct value, depending on the weights.
These arguments about commutativity and order are really just the same as for regular linear interpolation (LERP) and online average computation.
Again, using 3 quaternions and uniform weights with the above algorithm gives slerp(slerp(a, b, 1/2), c, 1/3) but medians in a spherical triangle don't cross at 2:1 ratio in general.