Game Development Reference
In-Depth Information
The conjugate of a quaternion is q * = [ w ,- v ]
The inverse is q -1 = q * / N ( q ). Therefore, for unit quaternions the
inverse is the same as the conjugate.
Addition and subtraction involves q 0 ± q 1 =[ w 0 + w 1 , v 0 + v 1 ]
Multiplication is given by q 0 q 1 =[ w 0 w 1 - v 0 v 1 , v 0
v 1 + w 0 v 1 + w 1 v 0 ];
this operation is non-commutative, i.e. q 0 q 1 is not the same as q 1 q 0 .
The identity for quaternions depends on the operation; it is [1, 0 ] (where
0 is a zero vector (0, 0, 0)) for multiplication and [0, 0 ] for addition and
subtraction.
×
Rotation involves v
= qvq *, where v = [0, v ].
Turning a unit quaternion into a rotation matrix results in
1- 2 y 2 - 2 x 2
2 xy + 2 wz
2 xz - 2 wy
1- 2 x 2 - 2 z 2
R =
2 xy - 2 wz
2 yz - 2 wx
1- 2 x 2 - 2 y 2
2 xz + 2 wy
2 yz - 2 wx
We will consider the uses of quaternions for smooth interpolation of
camera orientation and techniques for converting quickly between the
different representations of rotation in Chapter 8.
Rotation about a point other than
the origin
To rotate about an arbitrary point, which in
many CGI applications is called the pivot
point , involves first translating a vertex to
the origin, doing the rotation then translating
it back. If the vertex [1, 1, 1] T were rotated
about the point (2, 0, 0), then we want to
consider the point (2, 0, 0) to be the origin.
By subtracting (2, 0, 0) from [1, 1, 1] T we
can now rotate as though this is the origin
then add (2, 0, 0) back to the rotated
vertex.