From f310574e04f6c949880ba0dfff980227b9843475 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Mon, 11 Apr 2011 09:39:20 +0000 Subject: [PATCH] - Shot::MultMatrix(Matrix44) now accepts matrices with scaling. Corrected the rotation multiplication. --- vcg/math/shot.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/vcg/math/shot.h b/vcg/math/shot.h index 3187fd2a..0a44c8f0 100644 --- a/vcg/math/shot.h +++ b/vcg/math/shot.h @@ -233,12 +233,13 @@ public: /* 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 */ - void MultMatrix( vcg::Matrix44 m44) - { - Extrinsics.tra = m44 * Extrinsics.tra; - m44[0][3] = m44[1][3] = m44[2][3] = 0.0; - Extrinsics.rot = m44 * Extrinsics.rot ; - } + void MultMatrix( vcg::Matrix44 m44) + { + Extrinsics.tra = m44 * Extrinsics.tra; + m44[0][3] = m44[1][3] = m44[2][3] = 0.0; //set no translation + 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 note: it is up to the caller to check the the matrix passed is a pure rototraslation