qslim_optimal_collapse_edge_callbacks.h 3.8 KB

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