infinite_cost_stopping_condition.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_INFINITE_COST_STOPPING_CONDITION_H
  9. #define IGL_INFINITE_COST_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 output
  18. // function handle will return true if cost of next edge is infinite.
  19. //
  20. // Inputs:
  21. // cost_and_placement handle being used by igl::collapse_edge
  22. // Outputs:
  23. // stopping_condition
  24. //
  25. IGL_INLINE void infinite_cost_stopping_condition(
  26. const std::function<void(
  27. const int,
  28. const Eigen::MatrixXd &,
  29. const Eigen::MatrixXi &,
  30. const Eigen::MatrixXi &,
  31. const Eigen::VectorXi &,
  32. const Eigen::MatrixXi &,
  33. const Eigen::MatrixXi &,
  34. double &,
  35. Eigen::RowVectorXd &)> & cost_and_placement,
  36. std::function<bool(
  37. const Eigen::MatrixXd &,
  38. const Eigen::MatrixXi &,
  39. const Eigen::MatrixXi &,
  40. const Eigen::VectorXi &,
  41. const Eigen::MatrixXi &,
  42. const Eigen::MatrixXi &,
  43. const std::set<std::pair<double,int> > &,
  44. const std::vector<std::set<std::pair<double,int> >::iterator > &,
  45. const Eigen::MatrixXd &,
  46. const int,
  47. const int,
  48. const int,
  49. const int,
  50. const int)> & stopping_condition);
  51. IGL_INLINE
  52. std::function<bool(
  53. const Eigen::MatrixXd &,
  54. const Eigen::MatrixXi &,
  55. const Eigen::MatrixXi &,
  56. const Eigen::VectorXi &,
  57. const Eigen::MatrixXi &,
  58. const Eigen::MatrixXi &,
  59. const std::set<std::pair<double,int> > &,
  60. const std::vector<std::set<std::pair<double,int> >::iterator > &,
  61. const Eigen::MatrixXd &,
  62. const int,
  63. const int,
  64. const int,
  65. const int,
  66. const int)>
  67. infinite_cost_stopping_condition(
  68. const std::function<void(
  69. const int,
  70. const Eigen::MatrixXd &,
  71. const Eigen::MatrixXi &,
  72. const Eigen::MatrixXi &,
  73. const Eigen::VectorXi &,
  74. const Eigen::MatrixXi &,
  75. const Eigen::MatrixXi &,
  76. double &,
  77. Eigen::RowVectorXd &)> & cost_and_placement);
  78. }
  79. #ifndef IGL_STATIC_LIBRARY
  80. # include "infinite_cost_stopping_condition.cpp"
  81. #endif
  82. #endif