fixed bugs in the harmonic field computing algorithm

This commit is contained in:
Luigi Malomo 2014-03-05 13:14:48 +00:00
parent 323362697a
commit 62ad64fdac
1 changed files with 5 additions and 4 deletions

View File

@ -41,20 +41,21 @@ public:
{ {
typedef Eigen::SparseMatrix<CoeffScalar> SpMat; // sparse matrix type typedef Eigen::SparseMatrix<CoeffScalar> SpMat; // sparse matrix type
typedef Eigen::Triplet<CoeffScalar> Triple; // triplet type to fill the matrix typedef Eigen::Triplet<CoeffScalar> Triple; // triplet type to fill the matrix
std::vector<size_t> remap;
RequirePerVertexFlags(m); RequirePerVertexFlags(m);
RequireCompactness(m); RequireCompactness(m);
RequireFFAdjacency(m); RequireFFAdjacency(m);
if (constraints.empty())
return false;
int n = m.VN(); int n = m.VN();
// Generate coefficients // Generate coefficients
std::vector<Triple> coeffs; // coefficients of the system std::vector<Triple> coeffs; // coefficients of the system
std::map<size_t,CoeffScalar> sums; // row sum of the coefficient matrix std::map<size_t,CoeffScalar> sums; // row sum of the coefficient matrix
vcg::tri::UpdateFlags<CMeshO>::FaceClearV(m); vcg::tri::UpdateFlags<MeshType>::FaceClearV(m);
for (size_t i = 0; i < m.face.size(); ++i) for (size_t i = 0; i < m.face.size(); ++i)
{ {
FaceType & f = m.face[i]; FaceType & f = m.face[i];
@ -110,7 +111,7 @@ public:
} }
// Perform matrix decomposition // Perform matrix decomposition
Eigen::SimplicialLDLT<Eigen::SparseMatrix<CoeffScalar> > solver; Eigen::SimplicialLDLT<SpMat> solver;
solver.compute(laplaceMat); solver.compute(laplaceMat);
// TODO eventually use another solver (e.g. CHOLMOD for dynamic setups) // TODO eventually use another solver (e.g. CHOLMOD for dynamic setups)
if(solver.info() != Eigen::Success) if(solver.info() != Eigen::Success)