Question

Given a pivot matrix that is composed in the following manner:

  mat4w pivotedMat(true);
  pivotedMat.translate(P);
  pivotedMat *= pivotPos;
  pivotedMat *= pivotRot;
  pivotedMat *= R;
  pivotedMat *= pivotRot.getInverse();
  pivotedMat *= pivotPos.getInverse();
  pivotedMat.scale(S);

Which is then translated and rotated by another matrix such that:

mat4w newMat = transformMat * pivotedMat;

Is it possible to decompose the matrix (newMat) to retrieve the new values of P,R and S if all the values that composed the previous pivoted matrix are known?

No correct solution

OTHER TIPS

You can decompose an affine transformation matrix T into translation Pos and rotation Rot matrices using the following code:

mat4 Rot;
mat4 Pos;
mat4 InvT = T.GetInversed();

for ( int i = 0 ; i < 3 ; i++ )
{
    for ( int j = 0 ; j < 3 ; j++ )
    {
        Rot[i][j] = InvT[j][i];
    }
}

Pos = Rot.GetInversed() * vec3( -InvT[3].x, -InvT[3].y, -InvT[3].z );
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top