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

ribot

05-01-2003, 04: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.

ribot.

starman

05-02-2003, 07:56 AM

I had a similar question here recently:

http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/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))

ribot

05-02-2003, 09: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

Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.