View Full Version : Rotation around arbitrary axis
04-27-2000, 01:25 AM
For a rotation around an arbitrary axis (x,y,z), how can I calculate the corresponding rotations around the unit vectors (1,0,0) (0,1,0) and (0,0,1)?
04-27-2000, 01:36 AM
My guess is that you first glTransform to x,y,z and then glRotate(x_angle, 1, 0, 0), glRotate(y_angle, 0, 1, 0) and guess the z http://www.opengl.org/discussion_boards/ubb/wink.gif
04-27-2000, 01:41 AM
That didn't help much http://www.opengl.org/discussion_boards/ubb/smile.gif
The thing is, I know the number of radians to rotate around the (x,y,z) axis, and want to know the corresponding number of radians to rotate around the unit axes.
yep. opengl specifies rotations about an arbitary axis as quaternions. at least... i think this is right. i'm sure i'll be told if i'm wrong. http://www.opengl.org/discussion_boards/ubb/biggrin.gif
theres a paper in siggraph '86? or newer than that? about using quaternions in animation. basically, tho', the story is you CAN convert a quaternion to euler angles, although it would probably involve converting it to a rotation matrix and then extracting the euler angles out of that.
i can probably go and find it, if you'd like the formulae, and can't find it on the web. it's around here, someplace. http://www.opengl.org/discussion_boards/ubb/wink.gif
if you need to have a matrix that rotates about any axis, i'd suggest to use opengl as a matrix library and create the matrix with glRotate()
instead, if you need a "arbitrary to euler" matrix conversion utility function, take a look here:
04-27-2000, 10:24 PM
Thanks, that page was exactly what I was looking for!
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.