cotmatrix.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef IGL_COTMATRIX_H
  2. #define IGL_COTMATRIX_H
  3. #include "igl_inline.h"
  4. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  5. #include <Eigen/Dense>
  6. #include <Eigen/Sparse>
  7. // History:
  8. // Used const references rather than copying the entire mesh
  9. // Alec 9 October 2011
  10. // removed cotan (uniform weights) optional parameter it was building a buggy
  11. // half of the uniform laplacian, please see adjacency_matrix istead
  12. // Alec 9 October 2011
  13. namespace igl
  14. {
  15. // Constructs the cotangent stiffness matrix (discrete laplacian) for a given
  16. // mesh (V,F).
  17. //
  18. // Templates:
  19. // DerivedV derived type of eigen matrix for V (e.g. derived from
  20. // MatirxXd)
  21. // DerivedF derived type of eigen matrix for F (e.g. derived from
  22. // MatrixXi)
  23. // Scalar scalar type for eigen sparse matrix (e.g. double)
  24. // Inputs:
  25. // V #V by dim list of mesh vertex positions
  26. // F #F by simplex_size list of mesh faces (must be triangles)
  27. // Outputs:
  28. // L #V by #V cotangent matrix, each row i corresponding to V(i,:)
  29. //
  30. // See also: adjacency_matrix
  31. //
  32. // Known bugs: off by 1e-16 on regular grid. I think its a problem of
  33. // arithmetic order in cotangent.h: C(i,e) = (arithmetic)/dblA/4
  34. template <typename DerivedV, typename DerivedF, typename Scalar>
  35. IGL_INLINE void cotmatrix(
  36. const Eigen::MatrixBase<DerivedV> & V,
  37. const Eigen::MatrixBase<DerivedF> & F,
  38. Eigen::SparseMatrix<Scalar>& L);
  39. }
  40. #ifdef IGL_HEADER_ONLY
  41. # include "cotmatrix.cpp"
  42. #endif
  43. #endif