diff --git a/vcg/complex/algorithms/implicit_smooth.h b/vcg/complex/algorithms/implicit_smooth.h index b236c489..f3d10db2 100644 --- a/vcg/complex/algorithms/implicit_smooth.h +++ b/vcg/complex/algorithms/implicit_smooth.h @@ -81,6 +81,8 @@ public: bool fixBorder; //this bool is used to set if cotangent weight is used, this flag to false means uniform laplacian bool useCotWeight; + //use this weight for the laplacian when the cotangent one is not used + ScalarType lapWeight; //the set of fixed vertices std::vector FixedV; //the set of faces for barycentric constraints @@ -95,6 +97,7 @@ public: useMassMatrix=true; fixBorder=false; useCotWeight=false; + lapWeight=1; } }; @@ -277,7 +280,7 @@ public: //get the entries for laplacian matrix std::vector > IndexL; std::vector ValuesL; - MeshToMatrix::GetLaplacianMatrix(mesh,IndexL,ValuesL,SParam.useCotWeight); + MeshToMatrix::GetLaplacianMatrix(mesh,IndexL,ValuesL,SParam.useCotWeight,SParam.lapWeight); //initialize sparse laplacian matrix InitSparse(IndexL,ValuesL,matr_size*3,matr_size*3,L); diff --git a/vcg/complex/algorithms/mesh_to_matrix.h b/vcg/complex/algorithms/mesh_to_matrix.h index 94a2cd20..ae32d456 100644 --- a/vcg/complex/algorithms/mesh_to_matrix.h +++ b/vcg/complex/algorithms/mesh_to_matrix.h @@ -279,17 +279,17 @@ public: static void GetLaplacianEntry(MeshType &mesh, - FaceType &f, - std::vector > &index, - std::vector &entry, - bool cotangent) + FaceType &f, + std::vector > &index, + std::vector &entry, + bool cotangent, + ScalarType weight = 1) { if (cotangent) vcg::tri::MeshAssert::OnlyTriFace(mesh); for (int i=0;i::template CotangentWeight(f,i); @@ -322,13 +322,14 @@ public: static void GetLaplacianMatrix(MeshType &mesh, - std::vector > &index, - std::vector &entry, - bool cotangent) + std::vector > &index, + std::vector &entry, + bool cotangent, + ScalarType weight = 1) { //store the index and the scalar for the sparse matrix for (size_t i=0;i