From 62ad64fdacd8d11328040ef8aff72cb12bd7cdbd Mon Sep 17 00:00:00 2001 From: malomo Date: Wed, 5 Mar 2014 13:14:48 +0000 Subject: [PATCH] fixed bugs in the harmonic field computing algorithm --- vcg/complex/algorithms/harmonic.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/harmonic.h b/vcg/complex/algorithms/harmonic.h index f38cac0b..ea3c1d47 100644 --- a/vcg/complex/algorithms/harmonic.h +++ b/vcg/complex/algorithms/harmonic.h @@ -41,20 +41,21 @@ public: { typedef Eigen::SparseMatrix SpMat; // sparse matrix type typedef Eigen::Triplet Triple; // triplet type to fill the matrix - std::vector remap; - RequirePerVertexFlags(m); RequireCompactness(m); RequireFFAdjacency(m); + if (constraints.empty()) + return false; + int n = m.VN(); // Generate coefficients std::vector coeffs; // coefficients of the system std::map sums; // row sum of the coefficient matrix - vcg::tri::UpdateFlags::FaceClearV(m); + vcg::tri::UpdateFlags::FaceClearV(m); for (size_t i = 0; i < m.face.size(); ++i) { FaceType & f = m.face[i]; @@ -110,7 +111,7 @@ public: } // Perform matrix decomposition - Eigen::SimplicialLDLT > solver; + Eigen::SimplicialLDLT solver; solver.compute(laplaceMat); // TODO eventually use another solver (e.g. CHOLMOD for dynamic setups) if(solver.info() != Eigen::Success)