- Rotation matrix: Describes 3 DOF with 9 quantities
- Euler angles and the rotation vectors: Compact but suffer from the singularity
Quaternions are a way to represent rotations. Conceptually they are similar to complex numbers.
Complex Numbers for 2D Rotation
We use the complex set to represent the vector on a 2D complex plane, and the complex multiplication with a unit complex number represents rotation on the 2D plane.
- Multiplying by the complex is equivalent to rotating a complex vector counteclockwise by .
For example, when we want to rotate the vector of a complex plane by , we can multiply this complex vector by , which is represented by polar coordinates. It can also be written in the form of the Euler equation:
This is a unit-length complex number. Therefore, in two dimensions, the rotation can be described by a unit complex number.
Definition
Quaternions are basically a 3D version of the idea above. A quaternion has a real part and three imaginary parts:
If we look at as three axes, they look the same as complex numbers when multiplying with themselves, and the same as the outer product when multiplying with the others.
We can also use a scalar and a vector to express quaternions:
Here, is the real part of the quaternion, and is its imaginary part. If the imaginary part of a quaternion is 0, it is called real quaternion. Conversely, if its real part is 0, it is called imaginary quaternion.
We can use a unit quaternion to represent any rotation in 3D space, but it’s not the same as complex numbers. In the complex, multiplying by means rotating by . In quaternion form, multiplied by is rotating around the axis by ? So, does means, first rotating around the by , then around by , is equivalent to rotating around by ? This is not the case. the correct case would be that multiplying corresponds to rotating , to guarantee that . Thus, means that after rotating around the axis, we get the opposite thing. This object has to be rotated by to be equal to its original appearance.
Using Quaternions to Represent a Rotation
We can use a quaternion to express the rotation of a point. Suppose a point in 3D space and rotation is specified by a unit quaternion . The 3D point is rotated to become . If we use a Rotation Matrix, then there is . And if we use quaternion to describe rotation, how do we operate a 3D vector with a quaternion?
First, we extend the 3D point to an imaginary quaternion:
We just put the 3 coordinates into the imaginary part and leave the real part to be zero. Then, the rotated point can be expressed as such a a product:
The multiplication here is the quaternion multiplication, and the result is also a quaternion. Finally, we take the imaginary part of and get the coordinates of the point after the rotation. It can be easily verified (we leave as an exercise here) that the real part of the calculation is , so it is a pure imaginary quaternion.