max_faces_stopping_condition.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. // orig_m number (size) of original face list _**not**_ including any
  24. // faces added to handle phony boundary faces connecting to point at
  25. // infinity. For closed meshes it's safe to set this to F.rows()
  26. // max_m maximum number of faces
  27. // Outputs:
  28. // stopping_condition
  29. //
  30. IGL_INLINE void max_faces_stopping_condition(
  31. int & m,
  32. const int orig_m,
  33. const int max_m,
  34. std::function<bool(
  35. const Eigen::MatrixXd &,
  36. const Eigen::MatrixXi &,
  37. const Eigen::MatrixXi &,
  38. const Eigen::VectorXi &,
  39. const Eigen::MatrixXi &,
  40. const Eigen::MatrixXi &,
  41. const std::set<std::pair<double,int> > &,
  42. const std::vector<std::set<std::pair<double,int> >::iterator > &,
  43. const Eigen::MatrixXd &,
  44. const int,
  45. const int,
  46. const int,
  47. const int,
  48. const int)> & stopping_condition);
  49. IGL_INLINE
  50. std::function<bool(
  51. const Eigen::MatrixXd &,
  52. const Eigen::MatrixXi &,
  53. const Eigen::MatrixXi &,
  54. const Eigen::VectorXi &,
  55. const Eigen::MatrixXi &,
  56. const Eigen::MatrixXi &,
  57. const std::set<std::pair<double,int> > &,
  58. const std::vector<std::set<std::pair<double,int> >::iterator > &,
  59. const Eigen::MatrixXd &,
  60. const int,
  61. const int,
  62. const int,
  63. const int,
  64. const int)>
  65. max_faces_stopping_condition(
  66. int & m,
  67. const int orign_m,
  68. const int max_m);
  69. }
  70. #ifndef IGL_STATIC_LIBRARY
  71. # include "max_faces_stopping_condition.cpp"
  72. #endif
  73. #endif