Question about rotations... (first time poster)

Hi everyone,

Very simple question (although I’m not sure why the answer isn’t so simple to me!).

I would like to rotate an object around some fixed coordinate system. Problem is, when you begin one rotation around a given axis, this rotation affects all subsequent rotations.

I’m sure many have experienced this problem. Problem is, I’m not sure how to search for related topics because I cannot explain the problem in just a couple of words! I’ve tried several searches, but to no avail (so far).

The OpenGL wiki suggests that the use of quaternions might help solve this problem - but the suggested link is broken. I’ve never even heard of a quaternion - sounds like it’s out of Star Trek or something :stuck_out_tongue:

Anyhow, I promise to keep searching for solutions. But if anyone could suggest any direction I would greatly appreciate it. I’ll look into quaternions as well… but I it’s sounds like overkill for my situation.

Thanks in advance!

If you google for quaternions, you will find plenty of explanation (they are simple and very nice). Basicaly, they allow you to rotate something around a vector.

You can also rotate around an arbitrary axis with glRotate. Maybe this is enough for your purposes?

[ | vector_math (3d math library) | software renderer ]

I’ll look into quaternions.

As for the second response - glRotate is fine if you’re only rotating around a singular axis. As soon as you rotate around another, things get funny.

The rotation that OpenGL performs on vectors is almost identical to what you would get with a quaternion (see the formulation given on page 45 of the specification and compare that to a quaternion rotation of q* (0,v) q).

The trouble lies in concatenating rotation matrices, or repeatedly rotating individual basis vectors, which are not likely to remain orthogonal.

Fixed Euler angle rotation sequences are just fine if you understand their limitations.