Difference between matrices

Started by
3 comments, last by Marx2052 15 years, 5 months ago
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!
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.
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?
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.
Thanks a million, I knew I was just missing something simple!

Thanks again!

This topic is closed to new replies.

Advertisement