From d68f4271bccd8f1a12153a660c56afe45b3cd15e Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Sun, 12 Apr 2015 06:12:13 +0000 Subject: [PATCH] chenged SetFaceCrossVectorFromVert to take in consideration also magnitudo --- .../parametrization/tangent_field_operators.h | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/vcg/complex/algorithms/parametrization/tangent_field_operators.h b/vcg/complex/algorithms/parametrization/tangent_field_operators.h index ec586e46..87c36356 100644 --- a/vcg/complex/algorithms/parametrization/tangent_field_operators.h +++ b/vcg/complex/algorithms/parametrization/tangent_field_operators.h @@ -359,6 +359,29 @@ public: tF0.Normalize(); tF1.Normalize(); SetCrossVector(f,tF0,tF1); + + //then set the magnitudo + ScalarType mag1,mag2; + for (int i=0;i<3;i++) + { + vcg::Matrix33 rotN=vcg::RotationMatrix(f.V(i)->N(),f.N()); + CoordType rotatedDir=rotN*f.V(i)->PD1(); + + if (fabs(rotatedDir*tF0)>fabs(rotatedDir*tF1)) + { + mag1+=fabs(f.V(i)->K1()); + mag2+=fabs(f.V(i)->K2()); + } + else + { + mag1+=fabs(f.V(i)->K2()); + mag2+=fabs(f.V(i)->K1()); + } + } + + f.K1()=mag1/(ScalarType)3; + f.K2()=mag2/(ScalarType)3; + } static void SetFaceCrossVectorFromVert(MeshType &mesh)