HOW IT ALL WORKS
Briefly, the way arcball works is as follows:
- User clicks are projected on a sphere around the object that the user is rotating, to the hemisphere facing the user;
- Thus, whenever user drags the mouse, we obtain an arc on that sphere (hence "arcball");
- The object then is rotated along that arc by twice the angle of the arc;
- Quaternion multiplication is used to compute compositions of such rotations, since this is what, in a sense, quaternion multiplication is;
- Because of the math, whenever the user traces a closed loop, the result is no rotation.
The space of unit quaternions is a sphere in (set of points with ) with a multiplication rule (which we describe later).
There is a homomorphism (in fact, a double cover) from the space of unit quaternions to the space of rotations. What this means is that you can think of quaternion multiplication as composition of rotations; in practical terms, this accounts for the fact that the Arcball interface is path-independent (closed loops result in no rotation).
The homomorphism is as follows:
It is therefore convinient to store quaternion as a pair of a scalar and a vector; so we have
Note that the quaternions and correspond to the same rotation, and that these are the only unit quaternions corresponding to that rotation; any rotation in corresponds to exactly two quaternions in this way (hence the term "double cover").
Thus, the quaternion corresponding to rotating the vector to vector on the unit sphere (but by twice the angle between u and v) is
The multiplication of quaternions can be defined in terms of these parts:
One can derive this formula starting from another definition: write a quaternion , and then multiply quaternions using the rules and distribution laws. For the purposes of the arcball, however, this is not a convenient defintition.