Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subtracting two 4x4 Matrices - is this possible?

I have two 4x4 OPENGL Matrices -

  • 1st matrix holds rotation and position of an object at frame 0.

  • 2nd matrix holds rotation and position of an object at frame X;

I want to retrieve a movement offset of an object between frame 0 and X, is this enough ( possible ) if I just subtract both?

CMatrix4x4 offsetMatrix = matrixAtFrameX - matrixAtFrame0;

What I am doing is exporting per frame Bone transformation matrix where this matrix is an offset of the transformation between frame 0 of the animation and frame X.

  • Can I subtract both matrices ?

  • What are the results ?

like image 777
PeeS Avatar asked Apr 16 '12 14:04

PeeS


1 Answers

You'll need to multiply the matrix at frame x with the inverse of the matrix at frame 0.

matrixOffset = inverse(matrixAtFrame0) * matrixAtFrameX

This will give you the relative transformation and rotation between the frames.

like image 96
Andreas Brinck Avatar answered Nov 11 '22 03:11

Andreas Brinck