Representing Rotations with Quaternions
Many tasks in biomedical data analysis, such as kinematic data collection, involve 3-D motion analysis which requires precise representation of an object’s position and orientation. Mathematical operations such as interpolation, averaging and curve fitting, applied to translation are straightforward but are troublesome when applied to rotation. Another descriptor is necessary to carry out all these operations on rotations.
Various approaches exist such as rotation matrices, Euler angles, helical (or screw) axis and quaternions, but some have significant limitations. The first three all have restrictions limiting their usefulness for interpolating, averaging and curve fitting. Rotation matrices can drift numerically when repetitively multiplying matrices, resulting in undesired scaling or shearing. Euler angles can be defined in 12 different ways and each will give a different answer. They are also subject to gimbal lock, which is when two of the rotational axes align and you lose the ability to continue rotating freely. Both of the above are subject to tumbling during interpolation, where the object over-rotates while getting to the final orientation. Helical axis descriptions are handy for user interaction but do not provide a unique way to combine rotations into a single desired rotation. Quaternions overcome these difficulties.
Quaternions were discovered in 1843 by Sir William Hamilton after years of searching for a natural algebra of 3-D space. A quaternion is a complex four-component unit vector containing a single real component and three imaginary-like parts q = <w, i j k>. As unit vectors, quaternions always lie on the surface of a hypersphere. This hypersphere represents all possible rotations and all the possible paths between rotations. The shortest distance on the sphere between two points (just like the great circle airline routes) rotates the object the minimum amount to get to the final orientation.
Quaternions follow the same mathematical rules as standard complex numbers but in vector form. This means operations such as multiplication, division, powers, exponentials, or logarithms can be performed on quaternions. Not only that, interpolating and averaging rotational data is more realistic and more accurate.
Two rotations can be combined simply by multiplying two quaternions together. Averaging and curve fitting rotations become simple vector operations. Most importantly, because quaternions lie on a surface, interpolations of 3D rotations can be uniquely defined. Rotation between two orientations can be performed with spherical linear interpolation on the surface of this sphere (red line). Cubic interpolation on the sphere surface can represent smooth rotation through multiple orientations (yellow line).
Quaternions provide notational convenience and also provide a deeper mathematical foundation for 3D rotations. Quaternion mathematics expands the possibilities of how we can represent and manipulate rotations. In the lab, 3-D kinematic data analysis and computer motion simulation each require accurate and straightforward methods for calculating rotational data and quaternion mathematics supply both. When analyzing 3-D kinematics, quaternions provide simple and accurate answers.
For further reading on quaternions, see: Shoemake, K. "Animating Rotation with Quaternion Curves." Computer Graphics 19, 245-254, 1985.
James Coburn, PhD received his masters degree in Mechanical Engineering with the Orthopedic Biomechanics Laboratory at Brown University, and is close to completing his PhD. The research focus of the lab is musculoskeletal injury and repair ranging from studying muscle injury and ligament mechanics, to in vivo joint kinematics. Trey Crisco is an Associate Professor in Orthopaedics and Adjunct Professor in Engineering. He directs the Bioengineering Laboratory at Brown University.