Sign in to follow this  

Extracting an input matrix from a final matrix

This topic is 2045 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

This seams like it would be rather simple, but I'm having some trouble. I have a few matrices:
[code]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[/code]

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

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:
[code]State = Inverse(parent) * output;
State = State * JointToOrigin; // because JointToOrigin is the inverse of OriginToJoint
State = OriginToJoint * State; // because it is the inverse[/code]

Thank you for any help Edited by Kest

Share this post


Link to post
Share on other sites
[quote name='Kest' timestamp='1336748806' post='4939315']
This is how output is computed with these matrices:
[code]MATRIX output;
output = JointToOrigin * State;
output = output * OriginToJoint;
output = output * parent;[/code]
[/quote]

Did I understand correctly? You have the equation
[code]
output = JointToOrigin * state * OriginToJoint * parent;
[/code]
which equals
[code]
output = JointToOrigin * state * JointToOrigin^(-1) * parent;
[/code]
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
[code]
state = JointToOrigin^(-1) * output * parent^(-1) * JointToOrigin;
[/code]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 [url="http://clb.demon.fi/MathGeoLib/docs/float3x4_InverseOrthonormal.php"]float3x4::InverseOrthonormal[/url] or [url="http://clb.demon.fi/MathGeoLib/docs/float3x4_InverseOrthogonalUniformScale.php"]float3x4::InverseOrthogonalUniformScale[/url] depending on if you have scaling or not), and then use SSE to optimize the [url="https://github.com/juj/MathGeoLib/blob/master/src/Math/SSEMath.h#L494"]matrix*matrix multiplication[/url].

Share this post


Link to post
Share on other sites

This topic is 2045 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.

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