Jump to content
  • Advertisement
Sign in to follow this  
Vanderry

Extracting transformation from box mesh

This topic is 2690 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello people !

I have this transformed box mesh that I would like to extract the different transformation components (translation, rotation, scale) from. I'm able to extract vertex positions and their edge relationship, so it's easy to figure out the translation by adding them together and then dividing by 8. If I identify 3 perpendicular edges among the 12 that exist, the distance between their vertices should represent the scale (although I'm not sure about the order). The main thing that puzzles me is the rotation.

Would I be able to safely use the direction of those 3 edges to extract the rotation, and if so - how? It would be convenient to represent the transformation as a 4x4 matrix directly. Could I simply insert the 3 edges as column vectors into a 4x4 matrix and then add the translation into the last one? If this worked then the matrix could be applied to a unit size box and it would be identical to the one I started out with.

I hope I didn't mess up the problem description. Any help is appreciated !

- Dave

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you have it right. First you'll need to pick three mutually perpendicular edges that together have a positive determinant/triple product; if you know the order of the vertices, you should be able to draw an image with each vertex labeled, and then choose the edges appropriately.

If the transform is intended to be applied to the unit cube (1x1x1), then you should be able to simply load these vectors into the first three columns of the matrix (assuming column vectors are being used), as you described. The box position would then be stored in the fourth column.

Share this post


Link to post
Share on other sites

It sounds like you have it right. First you'll need to pick three mutually perpendicular edges that together have a positive determinant/triple product; if you know the order of the vertices, you should be able to draw an image with each vertex labeled, and then choose the edges appropriately.

If the transform is intended to be applied to the unit cube (1x1x1), then you should be able to simply load these vectors into the first three columns of the matrix (assuming column vectors are being used), as you described. The box position would then be stored in the fourth column.


I've been pondering this solution for some time now but doubted it due to uncertainties like the the edge-column relationship (and the general messiness of rotation matrices). Since the matrix will indeed be applied to a unit cube it makes sense now that the order won't matter. Thanks jyk for helping me believe ! :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!