From 3f18e449dca60521a04c3cd25e44cf46c6095a81 Mon Sep 17 00:00:00 2001 From: cignoni Date: Sat, 17 Nov 2007 15:41:42 +0000 Subject: [PATCH] added ComputeSimilarityMatchMatrix --- vcg/math/point_matching.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/vcg/math/point_matching.h b/vcg/math/point_matching.h index 54b4571a..5ee4e4ec 100644 --- a/vcg/math/point_matching.h +++ b/vcg/math/point_matching.h @@ -42,6 +42,43 @@ public: typedef Quaternion Quaternionx; +/* +Compute a similarity matching (rigid + uniform scaling) +simply create a temporary point set with the correct scaling factor + + +*/ +static bool ComputeSimilarityMatchMatrix( Matrix44x &res, + std::vector &Pfix, // vertici corrispondenti su fix (rossi) + std::vector &Pmov) // normali scelti su mov (verdi) +{ + Quaternionx qtmp; + Point3x tr; + + std::vector Pnew(Pmov.size()); + + ScalarType scalingFactor=0; + + for(size_t i=0;i<( Pmov.size()-1);++i) + { + scalingFactor += Distance(Pmov[i],Pmov[i+1])/ Distance(Pfix[i],Pfix[i+1]); + qDebug("Scaling Factor is %f",scalingFactor/(i+1)); + } + scalingFactor/=(Pmov.size()-1); + + for(size_t i=0;i &Pfix, // vertici corrispondenti su fix (rossi)