This post is part of my Game Math Series.
A quaternion is a very useful mathematical object devised by Sir William Rowan Hamilton as an extension to complex numbers. It is often used to compactly represent 3D orientations with just four floating-point numbers, as opposed to using a 3-by-3 matrix that contains nine floating-point numbers, and it has other nice properties that I will talk about later.
As its name suggests, a quaternion is composed of four components, one in the real part, and the other three in the imaginary part. A quaternion is usually denoted as:
where is the real part, denotes the three imaginary axes, and denotes the three imaginary components.
For brevity, I will use the notation below to represent a quaternion:
The Fundamental Formula for Quaternions
Below is the fundamental formula that governs the arithmetics of quaternions:
With this formula, we can derive the following identities: