indented and minor changes

This commit is contained in:
Nico Pietroni 2016-05-01 15:34:32 +00:00
parent 97a0879676
commit e091e22735
1 changed files with 302 additions and 273 deletions

View File

@ -246,7 +246,8 @@ public:
static void MassMatrixEntry(MeshType &m,
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry)
std::vector<ScalarType> &entry,
bool vertexCoord=true)
{
tri::RequireCompactness(m);
@ -266,6 +267,8 @@ public:
//store the index and the scalar for the sparse matrix
for (size_t i=0;i<m.vert.size();i++)
{
if (vertexCoord)
{
for (size_t j=0;j<3;j++)
{
@ -274,6 +277,13 @@ public:
entry.push_back(h[i]/maxA);
}
}
else
{
int currI=i;
index.push_back(std::pair<int,int>(currI,currI));
entry.push_back(h[i]/maxA);
}
}
tri::Allocator<MeshType>::template DeletePerVertexAttribute<ScalarType>(m,h);
}
@ -283,7 +293,8 @@ public:
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry,
bool cotangent,
ScalarType weight = 1)
ScalarType weight = 1,
bool vertexCoord=true)
{
if (cotangent) vcg::tri::MeshAssert<MeshType>::OnlyTriFace(mesh);
@ -299,6 +310,8 @@ public:
int indexV0=Index(mesh,f.V0(i));
int indexV1=Index(mesh,f.V1(i));
if (vertexCoord)
{
//then assemble the matrix
for (int j=0;j<3;j++)
{
@ -315,7 +328,22 @@ public:
entry.push_back(weight);
index.push_back(std::pair<int,int>(currI1,currI0));
entry.push_back(-weight);
}
}
else
{
int currI0=(indexV0);
int currI1=(indexV1);
index.push_back(std::pair<int,int>(currI0,currI0));
entry.push_back(weight);
index.push_back(std::pair<int,int>(currI0,currI1));
entry.push_back(-weight);
index.push_back(std::pair<int,int>(currI1,currI1));
entry.push_back(weight);
index.push_back(std::pair<int,int>(currI1,currI0));
entry.push_back(-weight);
}
}
}
@ -325,11 +353,12 @@ public:
std::vector<std::pair<int,int> > &index,
std::vector<ScalarType> &entry,
bool cotangent,
ScalarType weight = 1)
ScalarType weight = 1,
bool vertexCoord=true )
{
//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,weight);
GetLaplacianEntry(mesh,mesh.face[i],index,entry,cotangent,weight,vertexCoord);
}