
First, we extract the rotation angle from q 0: Given the quaternion q = ( q 0, q 1, q 2, q 3), we can convert back to an axis-angle representation as follows. Performing them ahead of time means that most quaternion operations can be accomplished using only multiplication/division and addition/subtraction, thus saving valuable computer cycles.

Since the axis-angle and quaternion representations contain exactly the same information, it is reasonable to ask why we would bother with the less-intuitive quaternions at all? The answer is that to do anything useful with an axis-angle quantity-such as rotate a set of points that make up some 3D object-we have to perform these trigonometric operations anyway. One consequence of this representation is that the magnitude of a rotation quaternion (that is, the sum of the squares of all four components) is always equal to one. This is illustrated in Figure 1:įigure 1: Any 3D rotation can be specified by an axis of rotation and a rotation angle around that axisĪn axis-angle rotation can therefore be represented by four numbers as in equation 3:įrom these equations we can see that the real term of the quaternion ( q 0) is completely determined by the rotation angle, and the remaining three imaginary terms ( q 1, q 2 and q 3) are just the three rotation axis vectors scaled by a common factor. We will therefore start with an explanation of the axis-angle representation, and then show how to convert to a quaternion.Īxis-Angle Representation of 3D RotationsĪccording to Euler's rotation theorem, any 3D rotation (or sequence of rotations) can be specified using two parameters: a unit vector that defines an axis of rotation and an angle θ describing the magnitude of the rotation about that axis.

Rotation quaternions are closely related to the axis-angle representation of rotation. Using them requires no understanding of complex numbers. Rotation quaternions are a mechanism for representing rotations in three dimensions, and can be used as an alternative to rotation matrices in 3D graphics and other applications. However, in this paper we will restrict ourselves to a subset of quaternions called rotation quaternions.
