I try to explain you my problem. I take an example. I have some cubes with different textures on each face. The goal is to rotate the cubes to built the good image like a puzzle. Now i want to know when someone wins the game i.e. when the cubes are in the correct orientation. I can store the 3 angles on x, y and z but as you preaphs know, making a rotation on y and on x and on z … is not making a rotation on z and on y and on x. The order is important. So i can’t only compare the actual x,y,z angles to some final x,y,z values. In other words, i can’t say the cube is in the correct orientation for instance if x=250,y=120,z=30.
Is someone has an idea, it will help me very much.
Keep a local system of vectors xloc, yloc and zloc…
I heard about quaternions, but I still ignore what they are
However they (maybe) have to do with your problem…
quaternions are a way of expressing rotations. Its theory is based on an extension to the complex number system with even more imaginary numbers. Ultimately, however, quaternions spefify a rotation by a rotation about some arbitrary vector. In fact, the parameter glRotate*() is actually a quaternion. They’re specially useful for tweening rotations. Check out:
“Animating Rotation with Quaternion Curves,” K.Shoemake, Ccomputer Graphcis, V.19 N3, 1985
“Smooth Interpolation of Orientations with Angular Veolcoity Constraints using Quaternions”, A.H.Barr, B.Currin, S.Gabriel, J.F.Hughes, Computer Graphics 26, 2, 1992
glRotate is a quaternion? I always assumed it was and axis and an angle?
Correct, glRotate is an axis and angle, not a quaternion. An axis and angle does map one to one and onto the set of unit quarternions however. But that mapping has nothing to do with glRotate.