A quaternion can represent both a rotation axis and the angle of rotation about this axis (a vector and a scalar). Instead of turning an object through a series of successive rotations with rotation matrices, quaternions are used to rotate an object more smoothly around an arbitrary axis (here ) and at any angle. This program uses the quaternion rotation formula: with (a pure quaternion), , and for a unit quaternion , such that if , . A derivation of these formulas is given in [1].