Floatingpoint arithmetic the computer isnt totally accurate
156 Chapter 9 The Mathematics of Rotations
resentation of orientation isn’t simple. Unlike for the twodimensional case, we have more than just the bounds to worry about: it isn’t clear how to combine rotations easily because the axis as well as the angle need to change.
Θ =⎡ ⎢⎣txy − sz ty2+ c tyz + sx txz + sy tyz − sx tz2+ x tx2+ c txy + sz txz − sy⎤ ⎥⎦ [9.3]
where
⎡x
9.2.4 



where 


[9.4]  

⎤⎥⎦ 
Quaternions are not merely a fourelement vector, however; the mathematics is more exotic. If you are allergic to mathematics, then feel free to skip this explanation and head for the next section.
You may remember in high school mathematics learning about the square root of −1, the socalled imaginary number (in contrast to real numbers), often written as i or j. So i2= −1. A complex number is then made up of both a real number and some multiple of i, in the form a + bi. If your mathematical memory is very good, you might recall drawing complex numbers as coordinates in two dimensions and deriving lots of their properties geometrically. Complex numbers have a very strong connection with geometry and in particular with rotations in two dimensions. If you don’t remember, not to worry—quaternions are a little more complex still.
Together these are the fundamental formulae of quaternion algebra.1The second part of this result means that any two of the three imaginary numbers, when multiplied
1. The formulae are reputed to have been scratched in the stone of the Bougham Bridge near Dublin by the discoverer of quaternions, William Rowan Hamilton (the site is now marked by a plaque and the original carving, if it existed, cannot be seen).