Added the possibility of passing the weights to set in the matrix of the implicit smoother.
This commit is contained in:
parent
965d8f0fbf
commit
c3bfe8f269
|
@ -81,6 +81,8 @@ public:
|
||||||
bool fixBorder;
|
bool fixBorder;
|
||||||
//this bool is used to set if cotangent weight is used, this flag to false means uniform laplacian
|
//this bool is used to set if cotangent weight is used, this flag to false means uniform laplacian
|
||||||
bool useCotWeight;
|
bool useCotWeight;
|
||||||
|
//use this weight for the laplacian when the cotangent one is not used
|
||||||
|
ScalarType lapWeight;
|
||||||
//the set of fixed vertices
|
//the set of fixed vertices
|
||||||
std::vector<int> FixedV;
|
std::vector<int> FixedV;
|
||||||
//the set of faces for barycentric constraints
|
//the set of faces for barycentric constraints
|
||||||
|
@ -95,6 +97,7 @@ public:
|
||||||
useMassMatrix=true;
|
useMassMatrix=true;
|
||||||
fixBorder=false;
|
fixBorder=false;
|
||||||
useCotWeight=false;
|
useCotWeight=false;
|
||||||
|
lapWeight=1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -277,7 +280,7 @@ public:
|
||||||
//get the entries for laplacian matrix
|
//get the entries for laplacian matrix
|
||||||
std::vector<std::pair<int,int> > IndexL;
|
std::vector<std::pair<int,int> > IndexL;
|
||||||
std::vector<ScalarType> ValuesL;
|
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
|
//initialize sparse laplacian matrix
|
||||||
InitSparse(IndexL,ValuesL,matr_size*3,matr_size*3,L);
|
InitSparse(IndexL,ValuesL,matr_size*3,matr_size*3,L);
|
||||||
|
|
|
@ -279,17 +279,17 @@ public:
|
||||||
|
|
||||||
|
|
||||||
static void GetLaplacianEntry(MeshType &mesh,
|
static void GetLaplacianEntry(MeshType &mesh,
|
||||||
FaceType &f,
|
FaceType &f,
|
||||||
std::vector<std::pair<int,int> > &index,
|
std::vector<std::pair<int,int> > &index,
|
||||||
std::vector<ScalarType> &entry,
|
std::vector<ScalarType> &entry,
|
||||||
bool cotangent)
|
bool cotangent,
|
||||||
|
ScalarType weight = 1)
|
||||||
{
|
{
|
||||||
if (cotangent) vcg::tri::MeshAssert<MeshType>::OnlyTriFace(mesh);
|
if (cotangent) vcg::tri::MeshAssert<MeshType>::OnlyTriFace(mesh);
|
||||||
|
|
||||||
for (int i=0;i<f.VN();i++)
|
for (int i=0;i<f.VN();i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
ScalarType weight = 1;
|
|
||||||
if (cotangent)
|
if (cotangent)
|
||||||
{
|
{
|
||||||
weight=Harmonic<MeshType>::template CotangentWeight<ScalarType>(f,i);
|
weight=Harmonic<MeshType>::template CotangentWeight<ScalarType>(f,i);
|
||||||
|
@ -322,13 +322,14 @@ public:
|
||||||
|
|
||||||
|
|
||||||
static void GetLaplacianMatrix(MeshType &mesh,
|
static void GetLaplacianMatrix(MeshType &mesh,
|
||||||
std::vector<std::pair<int,int> > &index,
|
std::vector<std::pair<int,int> > &index,
|
||||||
std::vector<ScalarType> &entry,
|
std::vector<ScalarType> &entry,
|
||||||
bool cotangent)
|
bool cotangent,
|
||||||
|
ScalarType weight = 1)
|
||||||
{
|
{
|
||||||
//store the index and the scalar for the sparse matrix
|
//store the index and the scalar for the sparse matrix
|
||||||
for (size_t i=0;i<mesh.face.size();i++)
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue