PDA

View Full Version : get the new position of a point after rotation and translation



jyoung77
03-25-2002, 09:17 AM
Hi,

Is there an OpenGL function, given a 3D coordinate, calculating its new 3D position based on the current modelview matrix? If not, do I have to inverse (or transform) the modelview matrix obtained from glGet() before applying it with the given 3D coordinate? Thanks for your help.

Tony

Morglum
03-25-2002, 09:31 AM
Opengl 's not a math API ! Yes, you have to perform matrix computations by yourself. The second part of your question seems somewhat ambiguous to me. I'll assume that you have a point at a *fixed* location in space and want to compute its coords (say Y)in the new basis
(corresponding to the modelview matrix M), and that you
already know its coords (say X) in the old basis (corresponding to the identity matrix). Then, yes, you have to invert M before applying it to X :

Y = (M^-1)X