Sign in to follow this  
Marx2052

Difference between matrices

Recommended Posts

Marx2052    122
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
Zipster    2365
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
Marx2052    122
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
KulSeran    3267
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this