Fixed-Axis Rotations, Quaternions


PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT

How to describe or specify arbitrary rotations ?

Specifying rotations with Euler angles can lead to problems in animation and in robotics, because the coordinate axes are singled out in a specific way.  For instance, flying a plane over the North Pole may suddenly flip it around;  or moving some mechanical linkage through multiple rotational operations may get it stuck in an awkward configuration, experiencing  'gimbal lock.'

To avoid these problems we need a representation for angles and rotations that is less
dependent on any coordinate system.
One such system is based on the "axis+angle" representation and can be realized with 'quaternions.'
Quaternions are normalized 4-vectors, where the four components encode the angle of rotation and the three components of the rotation axis.
Specifically:  the quaternion representing a rotation through an angle a around an axis of rotation with components rx, ry, rz of a normalized vector in the axis direction is given by
Q = [ cos(a/2),  sin(a/2)*rx,  sin(a/2)*ry,  sin(a/2)*rz ].

Its inverse is given by:
Q-1 = [ cos(a/2),  -sin(a/2)*rx,  -sin(a/2)*ry,  -sin(a/2)*rz ].
This can be understood as a rotation in the opposite direction.  Rather than negating the rotation angle, the rotation axis has been reversed.

To rotate some geometry by this quaternion, each  vertex  is first turned into a quaternion :  P  ==> Qp = [ 0, px, py, pz ]
and it is then rotated by forming the quaternion product:
Q'p = Q * Qp * Q-1


See:  Shirley 2nd Edition, Ch. 16.2.2   or   Shirley 3rd Edition, Ch. 17.2.2


PREVIOUS < - - - - > CS 184 HOME < - - - - > CURRENT < - - - - > NEXT