massmatrix_intrinsic.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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_INTRINSIC_H
  9. #define IGL_MASSMATRIX_INTRINSIC_H
  10. #include "igl_inline.h"
  11. #include "massmatrix.h"
  12. #include <Eigen/Dense>
  13. #include <Eigen/Sparse>
  14. namespace igl
  15. {
  16. // Constructs the mass (area) matrix for a given mesh (V,F).
  17. //
  18. // Inputs:
  19. // l #l by simplex_size list of mesh edge lengths
  20. // F #F by simplex_size list of mesh elements (triangles or tetrahedra)
  21. // type one of the following ints:
  22. // MASSMATRIX_TYPE_BARYCENTRIC barycentric
  23. // MASSMATRIX_TYPE_VORONOI voronoi-hybrid {default}
  24. // MASSMATRIX_TYPE_FULL full {not implemented}
  25. // Outputs:
  26. // M #V by #V mass matrix
  27. //
  28. // See also: adjacency_matrix
  29. //
  30. template <typename Derivedl, typename DerivedF, typename Scalar>
  31. IGL_INLINE void massmatrix_intrinsic(
  32. const Eigen::MatrixBase<Derivedl> & l,
  33. const Eigen::MatrixBase<DerivedF> & F,
  34. const MassMatrixType type,
  35. Eigen::SparseMatrix<Scalar>& M);
  36. // Inputs:
  37. // n number of vertices (>= F.maxCoeff()+1)
  38. template <typename Derivedl, typename DerivedF, typename Scalar>
  39. IGL_INLINE void massmatrix_intrinsic(
  40. const Eigen::MatrixBase<Derivedl> & l,
  41. const Eigen::MatrixBase<DerivedF> & F,
  42. const MassMatrixType type,
  43. const int n,
  44. Eigen::SparseMatrix<Scalar>& M);
  45. }
  46. #ifndef IGL_STATIC_LIBRARY
  47. # include "massmatrix_intrinsic.cpp"
  48. #endif
  49. #endif