Jump to content
  • Advertisement
Sign in to follow this  
Marx2052

Difference between matrices

This topic is 3496 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, My problem is as follows: I have two rotational matrices both stored in seperate 4x4 matrices which represent the rotation of two models. I wish to bring object B into the same frame as object A so I can preform collision detection without rotating object A. Is it possible to get the difference between these two matrices so that I can preform these calculations? My ideal answer would be in the form of a 3x3 rotational matrix which gives the rotation that would need to be applied to object B so it would be angled in relation to object A. Thanks in advance, Marx!

Share this post


Link to post
Share on other sites
Advertisement
Let's say you have vertex V in Frame A, and you want to take it to Frame B. You first need to "undo" Frame B, which would be B-1V (assuming B is also the rotation matrix associated with Frame B). You then need to take it into Frame A, which means multiplying again by A -- AB-1V. This assumes that Frame A and Frame B have the same direct parent frame (like canonical world space). If not, then you need to undo all the transformations on V up to the first common parent frame, and then perform all the transformations necessary to get to Frame B from that parent frame.

Share this post


Link to post
Share on other sites
Sorry, someone is being misunderstood here.

I have two objects A and B.
A is rotated by matA and B is rotated by matB.
Translations are also being applied but consider them seperate.

I'm trying to find the matrix matC that would rotate object B so that it is in the same relative position to A without rotating object A.

Normal math logic would make me think to simply subtract B from A and your left with the answer but with matrix math I'm not sure that will work.

Any ideas or am I misunderstanding you?

Share this post


Link to post
Share on other sites
So you have matA and matB, and you want to apply matC to object B such that you end up with the same relative location of B to A as if you rotated A by matA and B by matB.
Then matC is matA-1matB
Thusly matC rotates object B by matB then the inverse rotation you would have applied to object A.

where matA-1 symbolizes the inverse of matA.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!