The manner in which complex numbers were used to represent 2D
rotations will now be adapted to using quaternions to represent 3D
rotations. Let
represent the set of quaternions, in which
each quaternion,
, is represented as
, and
. A quaternion can be considered as a
four-dimensional vector. The symbols , , and are used to
denote three ``imaginary'' components of the quaternion. The
following relationships are defined:
,
from which it follows that , , and . Using
these, multiplication of two quaternions,
and
, can be derived to
obtain
, in which

(4.19)

Using this operation, it can be shown that
is a group with
respect to quaternion multiplication. Note, however, that the
multiplication is not commutative! This is also true of 3D
rotations; there must be a good reason.

For convenience, quaternion multiplication can be expressed in terms
of vector multiplications, a dot product, and a cross product. Let
be a three-dimensional vector that represents the
final three quaternion components. The first component of
is
. The final three components are
given by the three-dimensional vector
.

In the same way that unit complex numbers were needed for , unit
quaternions are needed for , which means that
is
restricted to quaternions for which
. Note
that this forms a subgroup because the multiplication of unit
quaternions yields a unit quaternion, and the other group axioms hold.

Figure 4.9:
Any 3D rotation can be considered as a
rotation by an angle about the axis given by the unit
direction vector
.

Figure 4.10:
There are two ways to encode the same
rotation.

The next step is to describe a mapping from unit quaternions to
. Let the unit quaternion
map to the
matrix

(4.20)

which can be verified as orthogonal and
. Therefore,
it belongs to . It is not shown here, but it conveniently
turns out that represents the rotation shown in Figure
4.9, by making the assignment

(4.21)

Unfortunately, this representation is not unique. It can be verified
in (4.20) that
. A nice geometric
interpretation is given in Figure 4.10. The quaternions
and represent the same rotation because a rotation of
about the direction is equivalent to a rotation of
about the direction . Consider the quaternion
representation of the second expression of rotation with respect to
the first. The real part is

(4.22)

The , , and components are

(4.23)

The quaternion has been constructed. Thus, and
represent the same rotation. Luckily, this is the only problem, and
the mapping given by (4.20) is two-to-one from the set of
unit quaternions to .

This can be fixed by the identification trick. Note that the set of
unit quaternions is homeomorphic to
because of the constraint
. The algebraic properties of quaternions
are not relevant at this point. Just imagine each as an element
of
, and the constraint
forces the
points to lie on
. Using identification, declare
for all unit quaternions. This means that the antipodal points of
are identified. Recall from the end of Section
4.1.2 that when antipodal points are identified,
. Hence,
, which can be
considered as the set of all lines through the origin of
, but
this is hard to visualize. The representation of
in Figure
4.5 can be extended to
. Start with
, and make three different kinds of identifications, one
for each pair of opposite cube faces, and add all of the points to the
manifold. For each kind of identification a twist needs to be made
(without the twist,
would be obtained). For example, in the
direction, let
for all
.

One way to force uniqueness of rotations is to require staying in the
``upper half'' of
. For example, require that , as
long as the boundary case of is handled properly because of
antipodal points at the equator of
. If , then require
that . However, if , then require that
because points such as
and are the same
rotation. Finally, if , then only is allowed. If such
restrictions are made, it is important, however, to remember the
connectivity of
. If a path travels across the equator of
, it must be mapped to the appropriate place in the ``northern
hemisphere.'' At the instant it hits the equator, it must move to the
antipodal point. These concepts are much easier to visualize if you
remove a dimension and imagine them for
, as
described at the end of Section 4.1.2.