From 0aec75be3949617033a5e3c44dc07dad371942ce Mon Sep 17 00:00:00 2001 From: malomo Date: Wed, 23 Mar 2016 17:08:22 +0000 Subject: [PATCH] added option for computing biharmonic field --- vcg/complex/algorithms/harmonic.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vcg/complex/algorithms/harmonic.h b/vcg/complex/algorithms/harmonic.h index e7f9b040..73fe5da7 100644 --- a/vcg/complex/algorithms/harmonic.h +++ b/vcg/complex/algorithms/harmonic.h @@ -55,7 +55,7 @@ public: * @note the algorithm has unexpected behavior if the mesh contains unreferenced vertices. */ template - static bool ComputeScalarField(MeshType & m, const ConstraintVec & constraints, ACCESSOR field) + static bool ComputeScalarField(MeshType & m, const ConstraintVec & constraints, ACCESSOR field, bool biharmonic = false) { typedef Eigen::SparseMatrix SpMat; // sparse matrix type typedef Eigen::Triplet Triple; // triplet type to fill the matrix @@ -115,6 +115,13 @@ public: } laplaceMat.setFromTriplets(coeffs.begin(), coeffs.end()); + if (biharmonic) + { + SpMat lap_t = laplaceMat; + lap_t.transpose(); + laplaceMat = lap_t * laplaceMat; + } + // Setting the constraints const CoeffScalar alpha = pow(10.0, 8.0); // penalty factor alpha