#include "cotmatrix.h" // For error printing #include #include "cotangent.h" template IGL_INLINE void igl::cotmatrix( const Eigen::MatrixBase & V, const Eigen::MatrixBase & F, Eigen::SparseMatrix& L) { using namespace igl; using namespace Eigen; DynamicSparseMatrix dyn_L (V.rows(), V.rows()); Matrix edges; int simplex_size = F.cols(); // 3 for triangles, 4 for tets assert(simplex_size == 3 || simplex_size == 4); if(simplex_size == 3) { // This is important! it could decrease the comptuation time by a factor of 2 // Laplacian for a closed 2d manifold mesh will have on average 7 entries per // row dyn_L.reserve(7*V.rows()); edges.resize(3,2); edges << 1,2, 2,0, 0,1; }else if(simplex_size == 4) { dyn_L.reserve(17*V.rows()); edges.resize(6,2); edges << 1,2, 2,0, 0,1, 3,0, 3,1, 3,2; }else { return; } // Gather cotangents Matrix C; cotangent(V,F,C); // Loop over triangles for(int i = 0; i < F.rows(); i++) { // loop over edges of element for(int e = 0;e(dyn_L); } #ifndef IGL_HEADER_ONLY // Explicit template specialization #endif