PDA

View Full Version : calculating the coordinates of a polygon after it has been rotated.



cluballs
01-21-2001, 07:21 AM
Hi

I would like to be able to find the vertices of a cuboid after it has been rotated. I have computed the vertices using trigonemtry when a cuboid is rotated by two axes, but I think using trig to compute the vertices of the cuboid after rotation about all three axes will be inefficient for several shapes in the scene.

It would be useful if the coordinates of the shapes can be found in some way by using the transformation matrix of the object or by obtaining them from some buffer from opengl.

Once the end points have been found they can be used for collision detection.

If anyone has ideas on how the coordinates can be found it would be very useful.

Michael Steinberg
01-21-2001, 10:24 AM
Multiply the object's modelview matrix with the eight vertices. That will result in the 8 worldspace vertices. (I wouldn't apply the camera matrix...)