Rotation around arbitrary axis

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)?

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

That didn’t help much

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.

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.


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:


Thanks, that page was exactly what I was looking for!