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 2 of 2

Thread: How to interchange glTranslate - glRotate

  1. #1
    Newbie Newbie
    Join Date
    Feb 2013
    Posts
    1

    How to interchange glTranslate - glRotate

    I want to interchange the order of rotation and translation.
    This is the original:

    glRotated(angle,0.0,0.0,1.0);
    glTranslated(x0,y0,z0);


    And this is the changed version that should be the exactly identical transformation:

    glTranslated(x1,y1,z1);
    glRotated(angle,0.0,0.0,1.0);

    Does anyone know the formula, how to calculate x1 y1 z1 from x0 y0 z0 and angle ?
    I need this to combine two translations that almost cancel and produce rounding errors.

  2. #2
    Senior Member OpenGL Pro Aleksandar's Avatar
    Join Date
    Jul 2009
    Posts
    1,074
    You need to solve a system of linear equations:
    T(v1)*R(a) = R(a)*T(v0) => T(v1) = R(a)*T(v0)*R(a)^-1

Posting Permissions

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