Quaternion Potential

I found your article on Nehe's web site very interesting. Would you have a version of the code using GLUT on Linux or Sun?

It's all standard C and OpenGL so it should work regardless of requiring GLUT.

Otherwise, if the port you want is not on the NeHe site then it doesn't exist.

Without actually trying it out myself I am having difficulties understanding why this is better than standard rotation (round an axis).

Well, the example focuses more on being a model “grab and rotate” utility rather than something that pushes radical concepts of rotation. The Quaternion is used to assist the transformation of a window click to a sphere's coordinate. The article explains how this all happens so I'll avoid repeating myself here.

However, consider this:

Quaternions are a vector, with rotation, on a unit sphere. Matrices are a series of linear algebra formulas that are x y and z coordinates(the vector) on their respective rotational circles. Therefore both can represent a rotation in the exact same way.

They both have similar properties in properties of concatenation and that type of thing.

A rotation matrix consists of nine components- one for each linear equation representing the rotation around the the base xyz axis. A rotation quaternion consists of four components, essentially the vector and rotational angle, although it's encoded into the quaternion instead of being “readily modifiable” like the matrix is.

In this simple case, the quaternion is more than half the size of the matrix- this means potentially quicker operations if you use quaternions instead of matrices.

But in reality, you'll never have a rotation without a translation. In the matrix case, we go from 3×3 to 4×4, brining the total amount of elements from nine to sixteen. In the quaternion case, we simply add a second vector for translation. (In the optimal case, three additional elements, however realistically you'll probably choose to use four elements for alignment or whatever.)

So in the realistic case this is still half the elements, and an even bigger speed gain can be realized. (Also think of memory usage here too.)

Quaternions again then have the potential to be of great use. About the only thing that's a bit tricky right now is that Matrix to Quaternion and Quaternion to Matrix operations are fairly intensive computationally(from what I recall anyway), which means that you'll either want to stick to one method or the other.