max_faces_stopping_condition.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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_MAX_FACES_STOPPING_CONDITION_H
  9. #define IGL_MAX_FACES_STOPPING_CONDITION_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. #include <set>
  14. #include <functional>
  15. namespace igl
  16. {
  17. // Stopping condition function compatible with igl::decimate. The outpute
  18. // function handle will return true if number of faces is less than max_m
  19. //
  20. // Inputs:
  21. // m reference to working variable initially should be set to current
  22. // number of faces.
  23. // max_m maximum number of faces
  24. // Outputs:
  25. // stopping_condition
  26. //
  27. IGL_INLINE void max_faces_stopping_condition(
  28. int & m,
  29. const int max_m,
  30. std::function<bool(
  31. const Eigen::MatrixXd &,
  32. const Eigen::MatrixXi &,
  33. const Eigen::MatrixXi &,
  34. const Eigen::VectorXi &,
  35. const Eigen::MatrixXi &,
  36. const Eigen::MatrixXi &,
  37. const std::set<std::pair<double,int> > &,
  38. const std::vector<std::set<std::pair<double,int> >::iterator > &,
  39. const Eigen::MatrixXd &,
  40. const int,
  41. const int,
  42. const int,
  43. const int,
  44. const int)> & stopping_condition);
  45. IGL_INLINE
  46. std::function<bool(
  47. const Eigen::MatrixXd &,
  48. const Eigen::MatrixXi &,
  49. const Eigen::MatrixXi &,
  50. const Eigen::VectorXi &,
  51. const Eigen::MatrixXi &,
  52. const Eigen::MatrixXi &,
  53. const std::set<std::pair<double,int> > &,
  54. const std::vector<std::set<std::pair<double,int> >::iterator > &,
  55. const Eigen::MatrixXd &,
  56. const int,
  57. const int,
  58. const int,
  59. const int,
  60. const int)>
  61. max_faces_stopping_condition(
  62. int & m,
  63. const int max_m);
  64. }
  65. #ifndef IGL_STATIC_LIBRARY
  66. # include "max_faces_stopping_condition.cpp"
  67. #endif
  68. #endif