cotmatrix_entries.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
  4. // Copyright (C) 2018 Alec Jacobson <alecjacobson@gmail.com>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla Public License
  7. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  8. // obtain one at http://mozilla.org/MPL/2.0/.
  9. #ifndef IGL_COTMATRIX_ENTRIES_H
  10. #define IGL_COTMATRIX_ENTRIES_H
  11. #include "igl_inline.h"
  12. #include <Eigen/Core>
  13. namespace igl
  14. {
  15. // COTMATRIX_ENTRIES compute the cotangents of each angle in mesh (V,F)
  16. //
  17. // Inputs:
  18. // V #V by dim list of rest domain positions
  19. // F #F by {3|4} list of {triangle|tetrahedra} indices into V
  20. // Outputs:
  21. // C #F by 3 list of 1/2*cotangents corresponding angles
  22. // for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  23. // OR
  24. // C #F by 6 list of 1/6*cotangents of dihedral angles*edge lengths
  25. // for tets, columns along edges [1,2],[2,0],[0,1],[3,0],[3,1],[3,2]
  26. //
  27. template <typename DerivedV, typename DerivedF, typename DerivedC>
  28. IGL_INLINE void cotmatrix_entries(
  29. const Eigen::MatrixBase<DerivedV>& V,
  30. const Eigen::MatrixBase<DerivedF>& F,
  31. Eigen::PlainObjectBase<DerivedC>& C);
  32. // Intrinsic version.
  33. //
  34. // Inputs:
  35. // l #F by 3 list of triangle edge lengths (see edge_lengths)
  36. // Outputs:
  37. // C #F by 3 list of 1/2*cotangents corresponding angles
  38. // for triangles, columns correspond to edges [1,2],[2,0],[0,1]
  39. template <typename Derivedl, typename DerivedC>
  40. IGL_INLINE void cotmatrix_entries(
  41. const Eigen::MatrixBase<Derivedl>& l,
  42. Eigen::PlainObjectBase<DerivedC>& C);
  43. }
  44. #ifndef IGL_STATIC_LIBRARY
  45. # include "cotmatrix_entries.cpp"
  46. #endif
  47. #endif