From 6a4631b94b0baa184ec58007634ff21215dbae58 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Wed, 23 Jul 2008 17:19:51 +0000 Subject: [PATCH] 1) in "ComputeWeightedRigidMatchMatrix" I changed: std::vector weights ----->to------> std::vector weights tmp.Trasp(); ----->to------> tmp.Transpose(); QQ.Zero(); ----->to------> QQ.SetZero(); RM.Zero(); ----->to------> RM.SetZero(); ccm.Trasp(); ----->to------> ccm.Transpose(); QQ.Jacobi(d,v,nrot); ----->to------> Jacobi(QQ,d,v,nrot); q.RotMatrix(Rot); ----->to------> q.ToMatrix(Rot); tr= (bfix - Rot.Apply(bmov)); ----->to------> tr= (bfix - Rot *bmov); Trn.Translate(tr); ----->to------> Trn.SetTranslate(tr); 2) in "ComputeRigidMatchMatrix" I changed: return ComputeRigidMatchMatrix(res,Pfix,Pmov,qtmp,tr); ----->to------> return ComputeWeightedRigidMatchMatrix(res,Pfix,Pmov,weights,qtmp,tr); --- vcg/math/point_matching.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/vcg/math/point_matching.h b/vcg/math/point_matching.h index 5e3f109b..425877b1 100644 --- a/vcg/math/point_matching.h +++ b/vcg/math/point_matching.h @@ -101,7 +101,7 @@ static bool ComputeRigidMatchMatrix(std::vector weights, { Quaterniond qtmp; Point3d tr; - return ComputeRigidMatchMatrix(res,Pfix,Pmov,qtmp,tr); + return ComputeWeightedRigidMatchMatrix(res,Pfix,Pmov,weights,qtmp,tr); } @@ -141,7 +141,7 @@ static bool ComputeWeightedRigidMatchMatrix(Matrix44x &res, std::vector &Pfix, std::vector &Pmov, - std::vector weights, + std::vector weights, Quaternionx &q, Point3x &tr ) @@ -155,20 +155,20 @@ bool ComputeWeightedRigidMatchMatrix(Matrix44x &res, cyc=ccm; tmp=ccm; - tmp.Trasp(); + tmp.Transpose(); cyc-=tmp; Matrix44x QQ; - QQ.Zero(); + QQ.SetZero(); Point3x D(cyc[1][2],cyc[2][0],cyc[0][1]); Matrix33x RM; - RM.Zero(); + RM.SetZero(); RM[0][0]=-ccm.Trace(); RM[1][1]=-ccm.Trace(); RM[2][2]=-ccm.Trace(); RM+=ccm; - ccm.Trasp(); + ccm.Transpose(); RM+=ccm; QQ[0][0] = ccm.Trace(); @@ -185,7 +185,7 @@ bool ComputeWeightedRigidMatchMatrix(Matrix44x &res, Point4d d; Matrix44x v; int nrot; - QQ.Jacobi(d,v,nrot); + Jacobi(QQ,d,v,nrot); // printf("Done %i iterations\n %f %f %f %f\n",nrot,d[0],d[1],d[2],d[3]); // print(v); // Now search the maximum eigenvalue @@ -199,12 +199,12 @@ bool ComputeWeightedRigidMatchMatrix(Matrix44x &res, } // The corresponding eigenvector define the searched rotation, Matrix44x Rot; - q.RotMatrix(Rot); + q.ToMatrix(Rot); // the translation (last row) is simply the difference between the transformed src barycenter and the trg baricenter - tr= (bfix - Rot.Apply(bmov)); + tr= (bfix - Rot *bmov); //res[3][0]=tr[0];res[3][1]=tr[1];res[3][2]=tr[2]; Matrix44x Trn; - Trn.Translate(tr); + Trn.SetTranslate(tr); res=Rot*Trn; return true;