euler_characteristic.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Michael Rabinovich <michaelrabinovich27@gmail.com>
  4. // Copyright (C) 2017 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_EULER_CHARACTERISTIC_H
  10. #define IGL_EULER_CHARACTERISTIC_H
  11. #include "igl_inline.h"
  12. #include <Eigen/Dense>
  13. #include <Eigen/Sparse>
  14. #include <vector>
  15. namespace igl
  16. {
  17. // Computes the Euler characteristic of a given mesh (V,F)
  18. //
  19. // Inputs:
  20. // F #F by dim list of mesh faces (must be triangles)
  21. // Returns An int containing the Euler characteristic
  22. template <typename DerivedF>
  23. IGL_INLINE int euler_characteristic(
  24. const Eigen::MatrixBase<DerivedF> & F);
  25. // Computes the Euler characteristic of a given mesh (V,F)
  26. // Templates:
  27. // Scalar should be a floating point number type
  28. // Index should be an integer type
  29. // Inputs:
  30. // V #V by dim list of mesh vertex positions
  31. // F #F by dim list of mesh faces (must be triangles)
  32. // Returns An int containing the Euler characteristic
  33. template <typename Scalar, typename Index>
  34. IGL_INLINE int euler_characteristic(
  35. const Eigen::PlainObjectBase<Scalar> & V,
  36. const Eigen::PlainObjectBase<Index> & F);
  37. }
  38. #ifndef IGL_STATIC_LIBRARY
  39. # include "euler_characteristic.cpp"
  40. #endif
  41. #endif