- Shot::MultMatrix(Matrix44) now accepts matrices with scaling. Corrected the rotation multiplication.

This commit is contained in:
Paolo Cignoni 2011-04-11 09:39:20 +00:00
parent a5fc2fae6a
commit f310574e04
1 changed files with 7 additions and 6 deletions

View File

@ -233,12 +233,13 @@ public:
/* multiply the current reference frame for the matrix passed /* multiply the current reference frame for the matrix passed
note: it is up to the caller to check the the matrix passed is a pure rototraslation note: it is up to the caller to check the the matrix passed is a pure rototraslation
*/ */
void MultMatrix( vcg::Matrix44<S> m44) void MultMatrix( vcg::Matrix44<S> m44)
{ {
Extrinsics.tra = m44 * Extrinsics.tra; Extrinsics.tra = m44 * Extrinsics.tra;
m44[0][3] = m44[1][3] = m44[2][3] = 0.0; m44[0][3] = m44[1][3] = m44[2][3] = 0.0; //set no translation
Extrinsics.rot = m44 * Extrinsics.rot ; const S k = m44.GetRow3(0).Norm(); //compute scaling (assumed uniform)
} Extrinsics.rot = Extrinsics.rot * m44.transpose() * (1/k);
}
/* multiply the current reference frame for the similarity passed /* multiply the current reference frame for the similarity passed
note: it is up to the caller to check the the matrix passed is a pure rototraslation note: it is up to the caller to check the the matrix passed is a pure rototraslation