doublearea.h 2.1 KB

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