Two quaternions can be concatenated by multiplying them together. Like with matrices, the operation is carried out from right to left; the right quaternion's rotation is applied first and then the left quaternion's.
Assume you have two quaternions, q and p. They are subscripted with
3, which correspond to the
W components, respectively. These quaternions can be expressed in ijk notation, as shown:
To multiply these two quaternions together, distribute the components of p to the components of q. Distributing the real component is simple. Distributing p3 to q would look like this:
Distributing the imaginary components looks very similar. The real and imaginary parts are combined separately; the order of imaginary components matters. For example, distributing poi to q would look like this:
Fully distributing p to q looks like this:
Start simplifying for the case when imaginary numbers...