From NSDL Materials Digital Library Wiki
Quaternions are a mathematical construct that can be used to represent rotations of a rigid body while avoiding the singularities that arise from Euler angles. The quaternion concept was first proposed by Sir William Rowan Hamilton and its application to rigid body rotation elucidated by Arthur Cayley. Because quaternions do not commute under multiplication, they are also much more useful for interpolating the motion of rigid body between two different orientations.
A quaternion can be defined as an extension of the complex set :
Addition of quaternions proceeds component-wise. However, by virtue of the complex variables i, j, and k, multiplication of quaternions is not commutative. The non-commutation of quaternions corresponds to the non-commutation of rotation operations.
Rigid Body Rotation
The rotation matrix relates the orientation of a rigid body to space-fixed coordinates. A unit quaternion maps to the rotation matrix by
subject to a normalization constraint
Note that q0 = 1, q1 = q2 = q3 = 0 makes the rotation matrix equal to the identity matrix (i.e. the rigid body is in its initial orientation).
The motion of a rigid body can be broken into two modes: rotation and translation. The sum of the forces acting on a rigid body determines the change in position (translation) of the center of mass while the sum of the torques yields the change in orientation (rotation). Integrating the center of mass position is identical to integration methods described elsewhere (i.e. Verlet Algorithm, Leapfrog Algorithm) with the addition of an extra summing of forces step. These schemes have been adapted to the integration of the rigid body orientation , and obey the quaternion equation of motion:
-  Wikipedia Entry on Quaternions
-  Fincham, D. "Leapfrog Rotational Algorithms." Molecular Simulation (8) 165-178, 1992.
-  Omelyan, I.P. "Algorithm for numerical integration of the rigid-body equations of motion." Physical Review E (58) 1169-1172, 1998.