qslim_optimal_collapse_edge_callbacks.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. #ifndef IGL_QSLIM_OPTIMAL_COLLAPSE_EDGE_CALLBACKS_H
  2. #define IGL_QSLIM_OPTIMAL_COLLAPSE_EDGE_CALLBACKS_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <functional>
  6. #include <vector>
  7. #include <tuple>
  8. namespace igl
  9. {
  10. // Prepare callbacks for decimating edges using the qslim optimal placement
  11. // metric.
  12. //
  13. // Inputs:
  14. // E #E by 2 list of working edges
  15. // quadrics reference to list of working per vertex quadrics
  16. // v1 working variable to maintain end point of collapsed edge
  17. // v2 working variable to maintain end point of collapsed edge
  18. // Outputs
  19. // cost_and_placement callback for evaluating cost of edge collapse and
  20. // determining placement of vertex (see collapse_edge)
  21. // pre_collapse callback before edge collapse (see collapse_edge)
  22. // post_collapse callback after edge collapse (see collapse_edge)
  23. IGL_INLINE void qslim_optimal_collapse_edge_callbacks(
  24. Eigen::MatrixXi & E,
  25. std::vector<std::tuple<Eigen::MatrixXd,Eigen::RowVectorXd,double> > &
  26. quadrics,
  27. int & v1,
  28. int & v2,
  29. std::function<void(
  30. const int e,
  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. double &,
  38. Eigen::RowVectorXd &)> & cost_and_placement,
  39. std::function<bool(
  40. const Eigen::MatrixXd & ,/*V*/
  41. const Eigen::MatrixXi & ,/*F*/
  42. const Eigen::MatrixXi & ,/*E*/
  43. const Eigen::VectorXi & ,/*EMAP*/
  44. const Eigen::MatrixXi & ,/*EF*/
  45. const Eigen::MatrixXi & ,/*EI*/
  46. const std::set<std::pair<double,int> > & ,/*Q*/
  47. const std::vector<std::set<std::pair<double,int> >::iterator > &,/*Qit*/
  48. const Eigen::MatrixXd & ,/*C*/
  49. const int /*e*/
  50. )> & pre_collapse,
  51. std::function<void(
  52. const Eigen::MatrixXd & , /*V*/
  53. const Eigen::MatrixXi & , /*F*/
  54. const Eigen::MatrixXi & , /*E*/
  55. const Eigen::VectorXi & ,/*EMAP*/
  56. const Eigen::MatrixXi & , /*EF*/
  57. const Eigen::MatrixXi & , /*EI*/
  58. const std::set<std::pair<double,int> > & , /*Q*/
  59. const std::vector<std::set<std::pair<double,int> >::iterator > &, /*Qit*/
  60. const Eigen::MatrixXd & , /*C*/
  61. const int , /*e*/
  62. const int , /*e1*/
  63. const int , /*e2*/
  64. const int , /*f1*/
  65. const int , /*f2*/
  66. const bool /*collapsed*/
  67. )> & post_collapse);
  68. }
  69. #ifndef IGL_STATIC_LIBRARY
  70. # include "qslim_optimal_collapse_edge_callbacks.cpp"
  71. #endif
  72. #endif