euler_characteristic.h 1.1 KB

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