Unit quaternions are a mathematical representation of 3D rotations. They have 4 dimensions (one real and 3 imaginary) and can be represented as follows: a + i b + j c + k d or in terms of axis-angles: q = cos(a/2) + i ( x * sin(a/2)) + j (y * sin(a/2)) + k ( z * sin(a/2)) where: - a=angle of rotation. - x,y,z = vector representing axis of rotation.
A quaternion is a representation of a rotation from one coordinate frame to another coordinate frame. The mathematical relationship is given below:
If we have a quaternion:
q = qw + i qx + j qy + k qz ;
The direction cosine matrix that represents the same rotation is given by:
| 1 - 2*qy2 - 2*qz2 2*qx*qy - 2*qz*qw 2*qx*qz + 2*qy*qw |
| 2*qx*qy + 2*qz*qw 1 - 2*qx2 - 2*qz2 2*qy*qz - 2*qx*qw |
| 2*qx*qz - 2*qy*qw 2*qy*qz + 2*qx*qw 1 - 2*qx2 - 2*qy2 |
More information: