diff --git a/vcg/complex/algorithms/implicit_smooth.h b/vcg/complex/algorithms/implicit_smooth.h index 3bf26015..b236c489 100644 --- a/vcg/complex/algorithms/implicit_smooth.h +++ b/vcg/complex/algorithms/implicit_smooth.h @@ -50,19 +50,23 @@ public: int numF; std::vector BarycentricW; CoordType TargetPos; + ScalarType facePenalty; FaceConstraint() { numF=-1; + facePenalty=ScalarType(PENALTY); } FaceConstraint(int _numF, const std::vector &_BarycentricW, - const CoordType &_TargetPos) + const CoordType &_TargetPos, + const ScalarType fPenalty = ScalarType(PENALTY)) { numF=_numF; BarycentricW= std::vector (_BarycentricW.begin(),_BarycentricW.end()); TargetPos=_TargetPos; + facePenalty=fPenalty; } }; @@ -99,8 +103,8 @@ private: static void InitSparse(const std::vector > &Index, const std::vector &Values, - const size_t m, - const size_t n, + const int m, + const int n, Eigen::SparseMatrix& X) { assert(Index.size()==Values.size()); @@ -134,7 +138,7 @@ private: if (SParam.fixBorder) { //add penalization constra - for (int i=0;i &IndexRhs, std::vector &ValueRhs) { + ScalarType penalty; int baseIndex=mesh.vert.size(); for (size_t i=0;i=0); - assert(FaceN(ComponentConstraint,IndexV)); - WeightC.push_back(currW*PENALTY); + WeightC.push_back(currW*penalty); IndexC.push_back(std::pair(IndexV,ComponentConstraint)); - WeightC.push_back(currW*PENALTY); + WeightC.push_back(currW*penalty); //this to avoid the 1 on diagonal last entry of mass matrix IndexC.push_back(std::pair(ComponentConstraint,ComponentConstraint)); @@ -218,7 +224,7 @@ private: //add the diagonal value IndexRhs.push_back(ComponentConstraint); - ValueRhs.push_back(ComponentV*PENALTY); + ValueRhs.push_back(ComponentV*penalty); } } @@ -242,7 +248,7 @@ public: //add the entries for mass matrix if (SParam.useMassMatrix) MeshToMatrix::MassMatrixEntry(mesh,IndexM,ValuesM); //then add entries for lagrange mult due to barycentric constraints - for (int i=0;i