Game Development Reference
In-Depth Information
quaternion multiplication
Using quaternion
multiplication to rotate a
3D vector
−1 .
p
= qpq
(8.7)
We could prove this by expanding the multiplication, substituting in n
and θ, and comparing the result to the matrix we derived to rotate about an
arbitrary axis (Equation (5.1.3), page 144), and indeed this is the approach
taken in most texts on quaternions. While this certainly is an effective way
to verify that the trick works, it leaves us wondering how the heck somebody
could have ever stumbled upon it in the first place. In Section 8.7.3, we
derive the conversion from quaternion to matrix form in a straightforward
way, solely from the geometry of the rotations and without referring to
qpq
−1 . As for how the association was discovered, we cannot say for sure,
but we will offer a train of thought that can lead a person to discover the
connection between this strange product and rotations in Section 8.5.14.
This discussion also explains how a person might have discovered that it
would be fruitful to use half of the rotation angle for the components.
As it turns out, the correspondence between quaternion multiplication
and 3D vector rotations is more of a theoretical interest than a practical one.
Some people (“quaternio-philes?”) like to attribute quaternions with the
useful property that vector rotations are immediately accessible by using
Equation (8.7). To the quaternion lovers, we admit that this compact
notation is an advantage of sorts, but its practical benefit in computations
is dubious. If you actually work through this math, you will find that it
is just about the same number of operations involved as converting the
quaternion to the equivalent rotation matrix (by using Equation (8.20),
which is developed in Section 8.7.3) and then multiplying the vector by
this matrix. Because of this, we don't consider quaternions to possess
any direct ability to rotate vectors, at least for practical purposes in a
computer.
Although the correspondence between qpq
−1 and rotation is not of
direct practical importance, it is of supreme theoretical importance. It
leads us to a slightly different use of quaternion multiplication, and this use
is highly practical in programming. Examine what happens when multiple
rotations are applied to a vector. We'll rotate the vector p by the quaternion
a , and then rotate that result by another quaternion b :
−1 ) b
−1
p
= b ( apa
Concatenating multiple
rotations with
quaternion algebra
−1 b
−1 )
= ( ba ) p ( a
−1 .
= ( ba ) p ( ba )
Notice that rotating by a and then by b is equivalent to performing a single
rotation by the quaternion product ba . This is a key observation.
Search WWH ::




Custom Search