Rotations

Started by
3 comments, last by MrBob 16 years, 12 months ago
I have a simple stick figure that i am trying to add animations to him in opengl and i was wondering.. is there any way to rotate a point about an arbitrary axis in space other than with Quaternions? I know that i could translate to the origin, rotate, and then translate back, but that does not seem to be a effective way to handle joint rotations in a skeleton.
A priest, a rabbi, and a monkey walk into a bar. The bartender says," hey whats going on here, is this some kinda joke?"
Advertisement
You can use an axis-angle rotation matrix (though I believe this matrix is derived from quaternion mathematics).
A quaternion represents a rotation (or more precisely an orientation). There are other representations, such Euler angles, axis/angle, and 3x3 matrix. No matter which representation you choose, the method of doing the rotation will be the same (though the implementation will differ).

In OpenGL, glRotate() is used. It takes an angle (in degrees) and the X, Y, and Z components of a axis.

I hope that answers your question. Your question seems a little confused.
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
Keep in mind that with skeletal animation (where one vertex of a polygon may have a different parent bone than another vertex of the same polygon) you'll probably have to apply transformations to each vertex before you draw them. glRotate(), glTranslate(), glLoadMatrix(), etc. will throw an error if you pass them in between glBegin() and glEnd() statements. Matrix implementations are particularly good for this because:

0) You probably won't want to normalize your result (which is a key advantage quaternions have over matrices) as you're interpolating between key-frames
1) matrices have more general applications (so you can use them in other areas of your code)
3) Matrix multiplication is EASY!
Thanks for the info. I think i'm going to stick with using a matrix instead of trying to implement quaternions.
A priest, a rabbi, and a monkey walk into a bar. The bartender says," hey whats going on here, is this some kinda joke?"

This topic is closed to new replies.

Advertisement