View Full Version : new coordanites after transformation

kazmalak

03-30-2005, 05:52 AM

Hi everyone.

In my project, I draw an object and make transformations (a translation and two rotations). Now, I have to learn the new coordinates of the object. How can I find them?

Vinícius Reis

03-30-2005, 06:50 AM

I think you have multiply the cordanates by the trnsformation matrix.

Vinícius Reis

03-30-2005, 06:52 AM

I think you have to multiply the cordanates by the trnsformation matrix.

powerpad

03-30-2005, 07:05 AM

given your initial vertex position v = [x,y,z,w]

you can derive the current position v' by multiplying v with all the individual transformation matrices that you used to transform your vertex

e.g. v' = M_ROT2 * M_ROT1 * M_TRANS * v

where M_ROT1, M_ROT2 and M_TRANS are 4x4 matrices

kazmalak

03-31-2005, 03:42 AM

I have over 5000 vertices. I have found the transformation matrices and apply glMultMatrixf function instead of using glRotatef or glTranslatef. I have done these because you said i have to multiply the current position with individual transformation matrices. I can do that. However I think it will be time consuming to use both glMultMatrixf function for rotation and multiply these individual matrices with current matrix to find the new location. I feel I am doing the same job twice. Is there a way to learn the new location after making the transformations instead of making new matrix calculations?

kazmalak

03-31-2005, 03:59 AM

I heard it can be performed using feedback method and now I am trying to find tutorials about it. Is there anyone who knows how this method works?

H.Stony

03-31-2005, 01:29 PM

i think you don't have to recalculate alle the 5000 vertics. do it with a few points. load the transformed matrix and multiplicate the elements witch your old point in the right sequence.

kazmalak

03-31-2005, 09:55 PM

What should I do if I have to calculate the transformed locations of every 5000 vertices (not few points) ? Do I have to recalculate all by matrix multiplication?

H.Stony

03-31-2005, 10:13 PM

you could use feedback rendering mode but it is slow. i suppose you have your "object" in a class. you want the x,y,z of the object after transformation. Right? so you don't need the position of every vertex after transfomartion. Right? so you don't need glMulMatr or stuff like that. try do do it like the description in the 2nd post. sorry i don't understand your problem.

h,stony

H.Stony

03-31-2005, 10:32 PM

http://www.opengl.org/discussion_boards/...t=018235#000006 (http://www.opengl.org/discussion_boards/cgi_directory/ultimatebb.cgi?ubb=get_topic;f=2;t=018235#000006)

kazmalak

03-31-2005, 10:46 PM

Thanks Stony

Lastly, the only thing I want to know if I have to learn the coordinates of every 5000 points, which method will be faster? feedback method or the one you have described (multiply current location with the transformation matrices)

H.Stony

04-01-2005, 09:22 AM

first make sure (!) that you really need all these points! i think feedback rendering mode is slower but i don't know. try it (you could make a testprogram in which you try both with many many points and take the time for it (look for glutGet(GLUT_ELAPSED_TIME) . i know a sgi example about it. search for "feedback.c". if you would like to do the calculation (not the feedback mode way) every frame the program may be slower (these calculations will be done by the cpu and i don't know if want this)

ftp://ftp.sgi.com/opengl/opengl14.zip

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