170 Chapter 9 The M athematics of Rotations
where
⎡
⎢
⎣
x
y
z
⎤
⎥
⎦
is the axis, and θ is the angle, as before.
Quaternions are not merely a four-element vector, however; their mathematics are
more exotic. If you are allergic to mathematics, then feel free to skip this explanation
and head for the implementation in the next section.
You ma y remember in high school mathematics learning about the square root of
−1, the so-called imaginary number (in contrast to the real numbers), often w ritten
as i or j.So,i
2
=−1. A complex number is then made up of both a real number
and some multiple of i,intheforma + bi. If your mathematical memory is very
good, you might recall drawing complex numbers as coordinates in 2D (the Argand
diagram), and deriving lots of their