View Full Version : How to find object orientation?

05-08-2001, 11:14 AM

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.

thanks http://www.opengl.org/discussion_boards/ubb/smile.gif

05-08-2001, 01:20 PM
Keep a local system of vectors xloc, yloc and zloc...
I heard about quaternions, but I still ignore what they are http://www.opengl.org/discussion_boards/ubb/redface.gif
However they (maybe) have to do with your problem...

05-08-2001, 04:10 PM

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


05-08-2001, 10:18 PM

Thank you for your help. http://www.opengl.org/discussion_boards/ubb/smile.gif

05-09-2001, 02:25 AM
glRotate is a quaternion? I always assumed it was and axis and an angle?

05-09-2001, 04:02 AM
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.