3.3 Quaternions
Quaternions are extended complex numbers.
A quaternion q has a real part and three imaginary parts. where i, j, k are three imaginary parts of the quaternion. These three imaginary parts satisfy the following relationship: 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 , it is called real quaternion. Conversely, if its real part is , it is called imaginary quaternion.
3.3.1 Quaternion Operations
Addition and subtraction
Multiplication
Length It can be verified that the length of the product is the product of the lengths. This makes the unit quaternion keep unit-length when multiplied by another unit quaternion:
Conjugate
The conjugate of a quaternion is to take the imaginary part as the opposite: We get a real quaternion if the quaternion is multiplied by its conjugate. The real part is the square of its length:
Inverse According to this definition, the product of the quaternion and its inverse is the real quaternion : If is a unit quaternion, its inverse and conjugate are the same. So the inverse of the product has properties similar to matrices:
Scalar Multiplication
3.3.2 Use Quaternion to Represent a Rotation
Suppose a spatial 3D point , and a rotation is specified by a unit quaternion .
Extend the 3D point to an imaginary quaternion:
The rotated point can be expressed as such a product:
3.3.3 Conversion of Quaternions to Other Rotation Representations
The relationship between quaternions and rotation vectors / matrices.
Let , then define the following symbols and These two symbols map the quaternion to a 4x4 matrix.
Then, consider the problem of using a quaternion to rotate a spatial point. In summary, the conversion formula from quaternion to rotation vector can be written as: And for converting from other representations to quaternions, we only need to reversely follow the above steps.