massmatrix.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_MASSMATRIX_TYPE_H
  9. #define IGL_MASSMATRIX_TYPE_H
  10. #include "igl_inline.h"
  11. #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET
  12. #include <Eigen/Dense>
  13. #include <Eigen/Sparse>
  14. namespace igl
  15. {
  16. enum MassMatrixType
  17. {
  18. MASSMATRIX_TYPE_BARYCENTRIC = 0,
  19. MASSMATRIX_TYPE_VORONOI = 1,
  20. MASSMATRIX_TYPE_FULL = 2,
  21. MASSMATRIX_TYPE_DEFAULT = 3,
  22. NUM_MASSMATRIX_TYPE = 4
  23. };
  24. // Constructs the mass (area) matrix for a given mesh (V,F).
  25. //
  26. // Templates:
  27. // DerivedV derived type of eigen matrix for V (e.g. derived from
  28. // MatrixXd)
  29. // DerivedF derived type of eigen matrix for F (e.g. derived from
  30. // MatrixXi)
  31. // Scalar scalar type for eigen sparse matrix (e.g. double)
  32. // Inputs:
  33. // V #V by dim list of mesh vertex positions
  34. // F #F by simplex_size list of mesh faces (must be triangles)
  35. // type one of the following ints:
  36. // MASSMATRIX_TYPE_BARYCENTRIC barycentric
  37. // MASSMATRIX_TYPE_VORONOI voronoi-hybrid {default}
  38. // MASSMATRIX_TYPE_FULL full {not implemented}
  39. // Outputs:
  40. // M #V by #V mass matrix
  41. //
  42. // See also: adjacency_matrix
  43. //
  44. template <typename DerivedV, typename DerivedF, typename Scalar>
  45. IGL_INLINE void massmatrix(
  46. const Eigen::MatrixBase<DerivedV> & V,
  47. const Eigen::MatrixBase<DerivedF> & F,
  48. const MassMatrixType type,
  49. Eigen::SparseMatrix<Scalar>& M);
  50. }
  51. #ifndef IGL_STATIC_LIBRARY
  52. # include "massmatrix.cpp"
  53. #endif
  54. #endif