-
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.
-
Junior Member
Regular Contributor
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))
-
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
-
Forum Rules