Game Development Reference
The best and most widely used representation for orientations is the quaternion.
A quaternion represents an orientation with four values, related to the axis and angle
in the following way:
x sin 2
y sin 2
z sin 2
is the axis and θ is the angle, as before.
Quaternions are not merely a four-element vector, however; the mathematics is
more exotic. If you are allergic to mathematics, then feel free to skip this explanation
and head for the next section.
You may remember in high school mathematics learning about the square root
1, the so-called imaginary number (in contrast to real numbers), often written
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, in the form a
b i. If your mathematical memory is very good,
you might recall drawing complex numbers as coordinates in two dimensions and
deriving lots of their properties geometrically. Complex numbers have a very strong
connection with geometry and in particular with rotations in two dimensions. If you
don't remember, not to worry—quaternions are a little more complex still.
A quaternion is a number of the form w
y k, where i, j, and k are all
When all are multiplied together, we also get
Together these are the fundamental formulae of quaternion algebra. 1 The second part
of this result means that any two of the three imaginary numbers, when multiplied
1. The formulae are reputed to have been scratched in the stone of the Bougham Bridge near Dublin
by the discoverer of quaternions, William Rowan Hamilton (the site is now marked by a plaque and the
original carving, if it existed, cannot be seen).