Public Group

# Rotations

This topic is 4261 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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.

##### Share on other sites
You can use an axis-angle rotation matrix (though I believe this matrix is derived from quaternion mathematics).

##### Share on other sites
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.

##### Share on other sites
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!

##### Share on other sites
Thanks for the info. I think i'm going to stick with using a matrix instead of trying to implement quaternions.

1. 1
2. 2
Rutin
20
3. 3
khawk
16
4. 4
A4L
14
5. 5

• 11
• 16
• 26
• 10
• 11
• ### Forum Statistics

• Total Topics
633756
• Total Posts
3013710
×