massmatrix.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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_H
  9. #define IGL_MASSMATRIX_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. enum MassMatrixType
  16. {
  17. MASSMATRIX_TYPE_BARYCENTRIC = 0,
  18. MASSMATRIX_TYPE_VORONOI = 1,
  19. MASSMATRIX_TYPE_FULL = 2,
  20. MASSMATRIX_TYPE_DEFAULT = 3,
  21. NUM_MASSMATRIX_TYPE = 4
  22. };
  23. // Constructs the mass (area) matrix for a given mesh (V,F).
  24. //
  25. // Templates:
  26. // DerivedV derived type of eigen matrix for V (e.g. derived from
  27. // MatrixXd)
  28. // DerivedF derived type of eigen matrix for F (e.g. derived from
  29. // MatrixXi)
  30. // Scalar scalar type for eigen sparse matrix (e.g. double)
  31. // Inputs:
  32. // V #V by dim list of mesh vertex positions
  33. // F #F by simplex_size list of mesh elements (triangles or tetrahedra)
  34. // type one of the following ints:
  35. // MASSMATRIX_TYPE_BARYCENTRIC barycentric
  36. // MASSMATRIX_TYPE_VORONOI voronoi-hybrid {default}
  37. // MASSMATRIX_TYPE_FULL full {not implemented}
  38. // Outputs:
  39. // M #V by #V mass matrix
  40. //
  41. // See also: adjacency_matrix
  42. //
  43. template <typename DerivedV, typename DerivedF, typename Scalar>
  44. IGL_INLINE void massmatrix(
  45. const Eigen::MatrixBase<DerivedV> & V,
  46. const Eigen::MatrixBase<DerivedF> & F,
  47. const MassMatrixType type,
  48. Eigen::SparseMatrix<Scalar>& M);
  49. }
  50. #ifndef IGL_STATIC_LIBRARY
  51. # include "massmatrix.cpp"
  52. #endif
  53. #endif