Axis-angle, quaternion, and homogeneous transforms
Axis-angle parameterisation
Section titled “Axis-angle parameterisation”To solve the gimbal lock problem, we can adopt a redundant parameterisation using an axis with and an angle , resulting in four parameters overall.
The rotation can be found by transforming the coordinates of :
Given frame with axes (with coincident with ), we can rotate frame by about the -axis and by around the -axis.
If a transformation is expressed in frame as , then:
which leads to:
Using trigonometry we can find and :
The rotation matrix is:
We specified four parameters ( and ), but there’s the constraint , so the system actually has three degrees of freedom.
We can see that .
The axis-angle parameterisation isn’t globally invertible. However, it is locally invertible, which means that unlike the Euler one, there are no singularities such as gimbal lock.
Quaternions
Section titled “Quaternions”The inverse of a real number is , which, when multiplied by , gives 1.
For complex numbers we can find a similar concept: a number multiplied by its inverse still gives 1.
There is no equivalent concept in , but it exists in .
A quaternion is an element of a vector space over the reals with the form where is the basis set.
Quaternion product
Section titled “Quaternion product”Let’s define an axiom for quaternion bases:
from which we can derive the multiplication rules between any two basis elements:
To compute the product of quaternions we can use the shorthand notation:
Using the rules from the axiom above, the product of the vector parts can be simplified as . Thus the full product, with scalar and vector parts grouped, is:
Quaternion conjugate
Section titled “Quaternion conjugate”For a quaternion , the conjugate is:
The real number is the norm of the quaternion.
Inverse of a quaternion
Section titled “Inverse of a quaternion”A quaternion (except 0) has a unique inverse .
Quaternion rotations
Section titled “Quaternion rotations”Let’s go back to complex numbers. Recall that they can also be expressed in polar coordinates as .
Multiplying two complex numbers rotates the resulting vector, especially when both have unit norm:
Let’s consider a unit-length quaternion . We can express it as where is a unit vector defined as and .
The quaternion represents a rotation of angle about the axis defined by the vector .
Let’s take a pure quaternion . The vector rotated by can be computed using which yields a quaternion of the form .
Substituting and , we obtain Rodrigues’ rotation formula that describes the rotation of the vector :
The parameters of a unit-length quaternion correspond to three degrees of freedom, which can be expressed as:
- , , , , with the constraint ;
- , , , , with the constraint ;
Finding parameters from the rotation
Section titled “Finding parameters from the rotation”Given a rotation matrix , we can find the parameters:
Composition of rotations
Section titled “Composition of rotations”Let’s consider two rotations associated with the unit-length quaternions and . The first rotation transforms a vector into and the second transforms into .
The composition of rotations is the product of their corresponding quaternions.
Translations
Section titled “Translations”A point in frame can be expressed in frame as .
The inverse relation is found by isolating :
Homogeneous coordinates
Section titled “Homogeneous coordinates”We need a compact way to represent both rotation and translation.
To do that, we create the homogeneous representation of by appending a coordinate with value 1.
The homogeneous transformation matrix is defined as:
which can then be used as usual to apply transformations by multiplying with vectors:
The inverse transformation can be found by inverting the matrix:
Unlike rotation matrices, homogeneous transformations are not orthogonal, so . But they can still be composed using matrix multiplication.