doublearea.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef IGL_DOUBLEAREA_H
  2. #define IGL_DOUBLEAREA_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Dense>
  5. namespace igl
  6. {
  7. // DOUBLEAREA computes twice the area for each input triangle
  8. //
  9. // Templates:
  10. // DerivedV derived type of eigen matrix for V (e.g. derived from
  11. // MatrixXd)
  12. // DerivedF derived type of eigen matrix for F (e.g. derived from
  13. // MatrixXi)
  14. // DeriveddblA derived type of eigen matrix for dblA (e.g. derived from
  15. // MatrixXd)
  16. // Inputs:
  17. // V #V by dim list of mesh vertex positions
  18. // F #F by simplex_size list of mesh faces (must be triangles)
  19. // Outputs:
  20. // dblA #F list of triangle double areas
  21. //
  22. // Note: THESE ARE *NOT* SIGNED. In matlab doublearea is signed in 2d
  23. template <typename DerivedV, typename DerivedF, typename DeriveddblA>
  24. IGL_INLINE void doublearea(
  25. const Eigen::PlainObjectBase<DerivedV> & V,
  26. const Eigen::PlainObjectBase<DerivedF> & F,
  27. Eigen::PlainObjectBase<DeriveddblA> & dblA);
  28. // Same as above but use instrinsic edge lengths rather than (V,F) mesh
  29. // Templates:
  30. // DerivedV derived type of eigen matrix for V (e.g. derived from
  31. // MatrixXd)
  32. // DerivedF derived type of eigen matrix for F (e.g. derived from
  33. // MatrixXi)
  34. // DeriveddblA derived type of eigen matrix for dblA (e.g. derived from
  35. // MatrixXd)
  36. // Inputs:
  37. // l #F by dim list of edge lengths using
  38. // for triangles, columns correspond to edges 23,31,12
  39. // Outputs:
  40. // dblA #F list of triangle double areas
  41. template <typename Derivedl, typename DeriveddblA>
  42. IGL_INLINE void doublearea(
  43. const Eigen::PlainObjectBase<Derivedl> & l,
  44. Eigen::PlainObjectBase<DeriveddblA> & dblA);
  45. }
  46. #ifdef IGL_HEADER_ONLY
  47. # include "doublearea.cpp"
  48. #endif
  49. #endif