Results 1 to 4 of 4

Thread: rotation and matrix inverse

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2001
    Posts
    25

    rotation and matrix inverse

    If you rotate an object around its Y-axis, you'll find that the X- and Z-axes rotate with the object. A subsequent rotation around one of these axes rotates around the newly transformed axis and not the original axis.

    I want to perform transformations in a fixed coordinate system rather than the objectí»s local coordinate system.

    can anybody give me some hints?( I don't want to use quaternion.)

    in opengl, how to perform matrix inverse?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: rotation and matrix inverse

    I'll answer your second question first. OpenGL is not a matrix library. It has no facility for computing matrix inverses.

    As for rotating around a "fixed" coordinate system... it all depends on what you are trying to accomplish. I suspect you're trying to perform Euler angle rotations. That is, you have a rotation about each X, Y, Z axes that you want to apply to an object. The best way to do this is decompose the X,Y,Z rotations into two separate angle/axis rotations. I've written something about how to do this elsewhere on this board, so just do a search on Euler angles.

  3. #3
    Junior Member Newbie
    Join Date
    Aug 2001
    Posts
    25

    Re: rotation and matrix inverse

    Originally posted by Korval:
    I'll answer your second question first. OpenGL is not a matrix library. It has no facility for computing matrix inverses.

    As for rotating around a "fixed" coordinate system... it all depends on what you are trying to accomplish. I suspect you're trying to perform Euler angle rotations. That is, you have a rotation about each X, Y, Z axes that you want to apply to an object. The best way to do this is decompose the X,Y,Z rotations into two separate angle/axis rotations. I've written something about how to do this elsewhere on this board, so just do a search on Euler angles.

    hi Korval, I search the entire forum, but can't find what you have posted on this topic, will you explain me a detail?

    do you mean using Quaternion? I think there will have other way to work out. please let me know in detail.

    many thanks

    Jerry

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: rotation and matrix inverse

    Your problem is best stated like this:

    I have a model in an orientation (we will call it model space). I have a new orientation for it (world space). How do I transform it there?

    Pick two axes in model space. One of them should be the "front" (if your model has a front. Otherwise, it doesn't matter). The other is the "up" (once again, if your model has a natural up).

    Now, calculate where the "front" and "up" axes are pointing in world space. All this requires is applying your Euler angle rotations to these axes by hand. I won't go into it, but it shouldn't be too tough to figure out.

    Now that you have the initial front/up vectors and the final front/up vectors, you just need to rotate them into those positions.

    Take the cross product between the initial and final front vectors. This vector is the axis of rotation. The angle should be the acos(Dot(initial_front, final_front)). So, generate the rotation matrix for getting there (ie, glRotatef(angle, axis)).

    It would be best to generate this rotation matrix yourself, too, as we need to transform a vector by it. So, take this matrix, and transform the initial_up vector by this matrix. This becomes the transformed_up.

    Now, you do a second rotation. The axis for this rotation is the final_front vector. The angle is acos(Dot(transformed_up, final_up)). So, call glRotatef again.

Similar Threads

  1. Inverse Matrix
    By reaktor24 in forum OpenGL: General
    Replies: 1
    Last Post: 05-23-2012, 08:33 AM
  2. Replies: 3
    Last Post: 04-03-2010, 03:10 PM
  3. matrix inverse
    By powerpad in forum OpenGL: GLSL
    Replies: 2
    Last Post: 06-07-2005, 02:43 AM
  4. Inverse Matrix
    By ramana in forum OpenGL: Advanced Coding
    Replies: 5
    Last Post: 02-03-2004, 01:12 PM
  5. inverse matrix
    By DarkFX in forum OpenGL: General
    Replies: 2
    Last Post: 01-08-2004, 03:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean