View Full Version : x,y absolute position after translation/rotation in 2d

05-01-2003, 03:38 PM
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.


05-02-2003, 06:56 AM
I had a similar question here recently:

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

05-02-2003, 08:23 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

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. http://www.opengl.org/discussion_boards/ubb/smile.gif