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

Thread: x,y absolute position after translation/rotation in 2d

  1. #1
    Intern Newbie
    Join Date
    Aug 2002
    Location
    London, England
    Posts
    35

    x,y absolute position after translation/rotation in 2d

    Hi all,

    I am trying to figure out how I can determine my current absolute location after I have performed a translation and rotation. I am in 2d ortho mode, so hopefully this should simplify things...I'm thinking this may be to do with matrices but I don't know where to start.

    Feedback would be most appreciated.

    ribot.

  2. #2
    Junior Member Regular Contributor
    Join Date
    Feb 2003
    Location
    Westerville, Oh, USA
    Posts
    202

    Re: x,y absolute position after translation/rotation in 2d

    I had a similar question here recently:
    http://www.opengl.org/discussion_boa...ML/012687.html

    Also, Ortho mode has nothing do with it. You should be applying your translations and rotations to your ModelView matrix, not your projection matrix (i.e. after calling glMatrixMode(GL_MODELVIEW))

  3. #3
    Intern Newbie
    Join Date
    Aug 2002
    Location
    London, England
    Posts
    35

    Re: x,y absolute position after translation/rotation in 2d

    Thanks for your reply starman.

    I decided not to sleep last night and instead update my knowledge on matrix calculations.

    I now understand matrix addition, subtraction, scalar multiplication, matrix multiplication, determinants, inverse matrices, rotation, translation and scaling.

    All pretty simple, but new to me.

    Anyway, I found that by using the following matrix multiplication I could calculate the eventual x,p point that I was in urgent need to get hold of:

    cos(theta), -sin(theta)
    sin(theta), cos(theta)

    and multiply it against the point I need to translate and rotate (x,y).

    Very simple now that I look at it...but only once you know the correct formulae.

Posting Permissions

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