# Get cube points after transformations

• 06-30-2013, 03:23 PM
Barbarosa
Get cube points after transformations
Hello,

I have created a cube (with known vertices) and i rotate and traslate it. What i lack are the new positions of its vertices after the transformations. So the question is do i have to find the transformation matrix on paper in order to calculate the vertices, or there is some function to get them?

• 06-30-2013, 10:42 PM
tonyo_au
Why do you need the translated vertices?
• 07-01-2013, 01:06 AM
Barbarosa
I try to implement the separating axis theorem for some oriented bounding boxes (cubes in my case). So i need the unit vectors that represent the 3 local axis of each box. To find these unit vectors i subtract the vertices to get the vectors and then i normalize them. And that's where i stuck because i have to know the positions of the vertices after the transformations.
• 07-01-2013, 09:52 AM
Carmine
Quote:

Originally Posted by Barbarosa
... i have to find the transformation matrix on paper in order to calculate the vertices, or there is some function to get them?

Here's an example of how I do it using fixed pipeline OpenGL commands only.
Code :

```void Retrieve_Transformed_Vector (void) { glMatrixMode (GL_MODELVIEW); glLoadIdentity ();   // same modeling transformations that are applied to cube go here.   glTranslatef (corner[0], corner[1], corner[2]);   glGetFloatv (GL_MODELVIEW_MATRIX, transmat); // read manual on transmat, should be a GLfloat transmat[16] // transmat[12],[13],[14] are the new coordinates of corner }```
• 07-01-2013, 04:02 PM
Barbarosa
That's exactly what i was looking for. Thank you very much!