Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 6 of 6

Thread: Rotation around arbitrary axis

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Sweden
    Posts
    15

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

  2. #2
    Intern Contributor
    Join Date
    Feb 2000
    Location
    Breda, Netherlands
    Posts
    58

    Re: Rotation around arbitrary axis

    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

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Sweden
    Posts
    15

    Re: Rotation around arbitrary axis

    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.
    / LC

  4. #4
    Advanced Member Frequent Contributor
    Join Date
    Apr 2000
    Location
    Adelaide, South Australia, Australia
    Posts
    765

    Re: Rotation around arbitrary axis

    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.

    cheers,
    John

  5. #5
    Member Regular Contributor
    Join Date
    Feb 2000
    Location
    milano, italy
    Posts
    282

    Re: Rotation around arbitrary axis

    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:
    http://www.flipcode.com/documents/matrfaq.html

    Dolo/\/\ightY
    Dolo/\/\ightY

  6. #6
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    Sweden
    Posts
    15

    Re: Rotation around arbitrary axis

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •