Game Development Reference
In-Depth Information
the right by the conjugate achieved the same rotation that was desired,
with the opposite undesired rotation. If we combine these two steps, the
unwanted rotation is canceled out, and we are left with only the rotation
we want. Well, not quite, we are left with twice the rotation we want, but
this is easily fixed by using θ/2 instead of θ. Of course, we knew that θ/2
would appear somewhere, but now we see the reason. Let's summarize our
findings from the preceding paragraphs.
To extend the ideas about complex numbers and rotations from 2D to
quaternions, we first convert the vector [x,y,z] to quaternion form as v =
[0,(x,y,z)]. A straightforward approach to rotate the vector by the angle θ
about the axis n would be to create the quaternion q = [cosθ,sinθ n ] and
then perform the multiplication qv . This, however, does not work; while
the result contains the rotation we want, it also contains an unwanted
rotation into w. The multiplication vq
also produces the rotation we
want plus some unwanted rotation, but in this case the unwanted rotation
is exactly opposite of that produced by qv . The solution is to use the half
angle and set q = [cos(θ/2),sin(θ/2) n ], and the rotation is accomplished by
performing both multiplications: qvq
. The first rotation rotates halfway
to the goal, plus some unwanted rotation involving w. The second rotation
completes the desired rotation while also canceling the unwanted rotation.
Before we leave this section, let us go back and clear up one last finer
point. We mentioned that there are other ways we could embed the set of
quaternions within the set of 4 × 4 matrices. (Equations (8.11) and (8.12)
aren't the only way to do it.) McDonald [45] explores this idea in more
detail; here we merely want to note that this is another underlying cause
of the need for qvq
−1 . Using just a single multiplication, the variations in
the embedding would produce variations in the rotated result. When both
multiplications are present, the change from one style to another produces
a change on the left that is exactly canceled by the matching change on the
right.
8.5.15
Summary of Quaternions
Section 8.5 has covered a lot of math, and most of it isn't important to
remember. The facts that are important to remember about quaternions
are summarized here.
 
Search WWH ::




Custom Search