qslim_optimal_collapse_edge_callbacks.h 3.5 KB

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