Quaternions – Combining Rotation Quaternions

quaternions

If I combine 2 rotation quaternions by multiplying them, lets say one represents some rotation around x axis and other represents some rotation around some arbitrary axis.

The order of rotation matters, so the order of the quaternion multiplication to "combine" the rotation matters also.

My question is, how does the combining of quaternion rotations work? Is it like matrix transformations, where

$$(M_2 M_1) p = M_2 (M_1 p) \, ?$$

The point $p$ will be transformed by $M_1$, and then by $M_2$, even though technically it's just being multiplied by $M_2 M_1$. Do rotation quaternions work the same way? Does the earliest rotation have to be on the right side, and then subsequent rotations are applied by multiplying on the left?

Best Answer

To rotate a vector $v = ix + jy + kz$ by a quaternion $q$ you compute $v^q = q v q^{-1} $.

So if $q$ and $q'$ are two rotation quaternions, to rotate by $q$ then $q'$ you calculate $(v^q)^{q'} = q' q \,v\, q^{-1} q'^{-1} = q' q \,v\, (q' q)^{-1} = v^{q'q}.$


References

Quaternions and spatial rotation