From bc980f70cc75b109fd4e3a91c365e8591d3168c8 Mon Sep 17 00:00:00 2001 From: cignoni Date: Thu, 19 Jun 2014 11:45:00 +0000 Subject: [PATCH] Improved float/double consistency removing some wrong Point3f and substitued with MeshType::CoordType --- vcg/complex/algorithms/update/curvature.h | 26 +++++++++++++---------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/vcg/complex/algorithms/update/curvature.h b/vcg/complex/algorithms/update/curvature.h index 2b9e1af3..618a2837 100644 --- a/vcg/complex/algorithms/update/curvature.h +++ b/vcg/complex/algorithms/update/curvature.h @@ -61,6 +61,8 @@ public: typedef vcg::face::VFIterator VFIteratorType; typedef typename MeshType::CoordType CoordType; typedef typename CoordType::ScalarType ScalarType; + typedef typename MeshType::VertexType::CurScalarType CurScalarType; + typedef typename MeshType::VertexType::CurVecType CurVecType; private: @@ -246,8 +248,8 @@ public: CoordType Principal_Direction1 = T1 * c - T2 * s; CoordType Principal_Direction2 = T1 * s + T2 * c; - (*vi).PD1() = Principal_Direction1; - (*vi).PD2() = Principal_Direction2; + (*vi).PD1().Import(Principal_Direction1); + (*vi).PD2().Import(Principal_Direction2); (*vi).K1() = Principal_Curvature1; (*vi).K2() = Principal_Curvature2; } @@ -353,16 +355,18 @@ If pointVSfaceInt==false the covariance is computed by (analytic)integration ove if( prod > bestv){bestv = prod; best = i;} } - (*vi).PD1() = eigenvectors.GetColumn( (best+1)%3).normalized(); - (*vi).PD2() = eigenvectors.GetColumn( (best+2)%3).normalized(); + (*vi).PD1().Import(eigenvectors.GetColumn( (best+1)%3).normalized()); + (*vi).PD2().Import(eigenvectors.GetColumn( (best+2)%3).normalized()); // project them to the plane identified by the normal - vcg::Matrix33 rot; - ScalarType angle = acos((*vi).PD1().dot((*vi).N())); - rot.SetRotateRad( - (M_PI*0.5 - angle),(*vi).PD1()^(*vi).N()); + vcg::Matrix33 rot; + CurVecType NN = CurVecType::Construct((*vi).N()); + CurScalarType angle; + angle = acos((*vi).PD1().dot(NN)); + rot.SetRotateRad( - (M_PI*0.5 - angle),(*vi).PD1()^NN); (*vi).PD1() = rot*(*vi).PD1(); - angle = acos((*vi).PD2().dot((*vi).N())); - rot.SetRotateRad( - (M_PI*0.5 - angle),(*vi).PD2()^(*vi).N()); + angle = acos((*vi).PD2().dot(NN)); + rot.SetRotateRad( - (M_PI*0.5 - angle),(*vi).PD2()^NN); (*vi).PD2() = rot*(*vi).PD2(); @@ -675,8 +679,8 @@ static void MeanAndGaussian(MeshType & m) int minI = (bestNormalIndex+1)%3; if(fabs(lambda[maxI]) < fabs(lambda[minI])) std::swap(maxI,minI); - (*vi).PD1() = *(Point3*)(& vect[maxI][0]); - (*vi).PD2() = *(Point3*)(& vect[minI][0]); + (*vi).PD1().Import(vect.GetColumn(maxI)); + (*vi).PD2().Import(vect.GetColumn(minI)); (*vi).K1() = lambda[2]; (*vi).K2() = lambda[1]; }