Added the possibility of passing the weights to set in the matrix of the implicit smoother.

This commit is contained in:
giorgiomarcias 2014-12-23 19:47:14 +00:00
parent 965d8f0fbf
commit c3bfe8f269
2 changed files with 14 additions and 10 deletions

View File

@ -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<int> 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<std::pair<int,int> > IndexL;
std::vector<ScalarType> ValuesL;
MeshToMatrix<MeshType>::GetLaplacianMatrix(mesh,IndexL,ValuesL,SParam.useCotWeight);
MeshToMatrix<MeshType>::GetLaplacianMatrix(mesh,IndexL,ValuesL,SParam.useCotWeight,SParam.lapWeight);
//initialize sparse laplacian matrix
InitSparse(IndexL,ValuesL,matr_size*3,matr_size*3,L);

View File

@ -279,17 +279,17 @@ public:
static void GetLaplacianEntry(MeshType &mesh,
FaceType &f,
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry,
bool cotangent)
FaceType &f,
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry,
bool cotangent,
ScalarType weight = 1)
{
if (cotangent) vcg::tri::MeshAssert<MeshType>::OnlyTriFace(mesh);
for (int i=0;i<f.VN();i++)
{
ScalarType weight = 1;
if (cotangent)
{
weight=Harmonic<MeshType>::template CotangentWeight<ScalarType>(f,i);
@ -322,13 +322,14 @@ public:
static void GetLaplacianMatrix(MeshType &mesh,
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry,
bool cotangent)
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry,
bool cotangent,
ScalarType weight = 1)
{
//store the index and the scalar for the sparse matrix
for (size_t i=0;i<mesh.face.size();i++)
GetLaplacianEntry(mesh,mesh.face[i],index,entry,cotangent);
GetLaplacianEntry(mesh,mesh.face[i],index,entry,cotangent,weight);
}