I was reading Jason Gregory's "Game Engine Architecture". Since he uses row vectors, there's an example that goes
v' = v*R1*R2*R3
Rn being matrices. Instead, since I'm using column vectors, I would write v' = R3*R2*R1*v
.
He then proceeds
v' = q3*q2*q1*v*~q1*~q2*~q3
Notice how the quaternion product must be performed in an order opposite to that in which the rotations are applied
Does that mean that I should compute q1*q2*q3*v*~q3*~q2*~q1
instead?
Also, is the quaternion product associative?
is the quaternion product associative?
The *
operator is also called Hamilton product and it is associative.
Does that mean that I should compute
q1*q2*q3*v*~q3*~q2*~q1
instead?
No. You are interested in applying first rotation 1, then 2, and finally 3, right? So, for the sake of clarity, you can think of your operation as q3*(q2*(q1*v*~q1)*~q2)*~q3
. Considering that Hamilton product is not commutative you should keep that order.
Note that I used parentheses thinking that it would help interpret the equation easier. Since Hamilton product is associative, rearranging the parentheses will not change the result.