Advertisement

Extracting an input matrix from a final matrix

Started by May 11, 2012 03:06 PM
3 comments, last by Kest 12 years, 9 months ago
This seams like it would be rather simple, but I'm having some trouble. I have a few matrices:
output = the end result of this operation
JointToOrigin = some input matrix
OriginToJoint = The inverse of JointToOrigin
parent = parent->output (the output of this output's parent)
State = An input matrix, and the one I want to extract from output


This is how output is computed with these matrices:
MATRIX output;
output = JointToOrigin * State;
output = output * OriginToJoint;
output = output * parent;


Now assuming all of these matrices have the same values as the time of above, is it possible to determine the value of the original -State- matrix? Can anyone help me determine the order I would need to do this in? This is what I have tried, and I've tried re-arranging them, but I haven't had any luck:
State = Inverse(parent) * output;
State = State * JointToOrigin; // because JointToOrigin is the inverse of OriginToJoint
State = OriginToJoint * State; // because it is the inverse


Thank you for any help

This is how output is computed with these matrices:
MATRIX output;
output = JointToOrigin * State;
output = output * OriginToJoint;
output = output * parent;



Did I understand correctly? You have the equation

output = JointToOrigin * state * OriginToJoint * parent;

which equals

output = JointToOrigin * state * JointToOrigin^(-1) * parent;

and you want to solve for the matrix 'state', given that you know the matrices 'output', 'JointToOrigin' and 'parent'?

In that case, the answer is by straightforward manipulation

state = JointToOrigin^(-1) * output * parent^(-1) * JointToOrigin;
Advertisement
Yes, that is correct. And thank you very much for the correct answer.

Just out of curiousity, and not really related to my original question, is there any way to turn this computation:
output = JointToOrigin * State * OriginToJoint

Into a single (matrix * matrix) multiply? For instance, can I pre-calculate a matrix using JointToOrigin that will allow me to perform this step with one multiply instead of two?

Thank you again for your help.
Unfortunately this is not possible in general. Conjugation (multiplication by x*c*x^-1) is a whole different type of operation than standard left or right multiplication, and they are not interchangeable.

If I was trying to optimize that, I'd make sure I was using an efficient inversion routine (see float3x4::InverseOrthonormal or float3x4::InverseOrthogonalUniformScale depending on if you have scaling or not), and then use SSE to optimize the matrix*matrix multiplication.
Thanks for your help. I really appreciate it!

This topic is closed to new replies.

Advertisement