Transforming vectors
To multiply a vector and a quaternion, you first have to turn the vector into a pure quaternion. What is a pure quaternion? It's a quaternion whose W
component is 0
and the vector part is normalized. Assume you have a quaternion, q, and a vector, v. First, turn v into a pure quaternion, represented as v':
Next, multiply q by v' then multiply the result by the inverse of q. The result of this multiplication is a pure quaternion whose vector part contains the rotated vector. The quaternion becomes the following:
Why is v' multiplied by q and then q-1? Multiplying by q will rotate the vector twice as much as the rotation of q. Multiplying by q-1 brings the vector back into the expected range. This formula can be simplified further.
Deriving this formula is outside the scope of this book. Given a quaternion, q, and
a vector, v, the simplified vector quaternion multiplication formula is listed as follows.
qv refers to...