Using Quaternions for Parameterizing Orientation
The orientation of a rigid body in 3D space can be parameterized by a normalized quaternion. In this case the quaternion describes a rotation of 3D vectors. To rotate a 3D vector , it's coordinates are written as a pure quaternion . The coordinates of the rotated vector are computed as:
This rotation can be seen not only as a rotation in one coordinate system, but also as a transformation of coordinates of the same vector from one into another coordinate system. In this case we have only one vector , which can be written in coordinates of the body system as well as in coordinates of the fixed inertial system . Assuming that the quaternion defines the current orientation of the rigid body as a rotation from the initial orientation to the current orientation, the coordinates of the vector are transformed with:
Dealing with different coordinate systems one has to keep in mind that not only the coordinates of each vector are dependent on the coordinate system but also the rotation quaternions do. In the case of only one rotational quaternion , describing the orientation of the rigid body, this quaternion is the same in both systems. But introducing a second rotation quaternion to define a rotation of the orientation for example, it must be clear in which coordinate system the rotation should be applied:
defines a rotation of by in the fixed inertial system and
defines a rotation of by in the body system.
Axis Angles to Quaternion
Axis angles define a rotation by a single vector , where is a unit vector defining the rotation axis and is the angle of rotation. According to the Polar Form of quaternions, the rotation quaternion can be assembled from axis angles by:
which formulates a rotation around the axis (which has to be normalized) and the angle .
The transformation of coordinates from one into another system can also be calculated by a transformation matrix. By expanding the product for a given rotation quaternion the transformation matrix from coordinates of the body system to the inertial system yield:
and vice versa from inertial to body system
Angular Velocity of a Rigid Body
The temporal derivative of a quaternion which defines an orientation of a rigid body turning with angular velocity is computed as:
Expanding the latter identity with coordinates of in the body system yields