fast_winding_number.cpp 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #include "fast_winding_number.h"
  2. #include "../../fast_winding_number.h"
  3. #include "../../octree.h"
  4. #include "../../knn.h"
  5. #include "../../parallel_for.h"
  6. #include "point_areas.h"
  7. #include <vector>
  8. template <
  9. typename DerivedP,
  10. typename DerivedN,
  11. typename DerivedQ,
  12. typename BetaType,
  13. typename DerivedWN>
  14. IGL_INLINE void igl::copyleft::cgal::fast_winding_number(
  15. const Eigen::MatrixBase<DerivedP>& P,
  16. const Eigen::MatrixBase<DerivedN>& N,
  17. const Eigen::MatrixBase<DerivedQ>& Q,
  18. const int expansion_order,
  19. const BetaType beta,
  20. Eigen::PlainObjectBase<DerivedWN>& WN)
  21. {
  22. typedef typename DerivedWN::Scalar real;
  23. std::vector<std::vector<int> > point_indices;
  24. Eigen::Matrix<int,Eigen::Dynamic,8> CH;
  25. Eigen::Matrix<real,Eigen::Dynamic,3> CN;
  26. Eigen::Matrix<real,Eigen::Dynamic,1> W;
  27. Eigen::MatrixXi I;
  28. Eigen::Matrix<real,Eigen::Dynamic,1> A;
  29. octree(P,point_indices,CH,CN,W);
  30. knn(P,21,point_indices,CH,CN,W,I);
  31. point_areas(P,I,N,A);
  32. Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic> EC;
  33. Eigen::Matrix<real,Eigen::Dynamic,3> CM;
  34. Eigen::Matrix<real,Eigen::Dynamic,1> R;
  35. igl::fast_winding_number(
  36. P,N,A,point_indices,CH,expansion_order,CM,R,EC);
  37. igl::fast_winding_number(
  38. P,N,A,point_indices,CH,CM,R,EC,Q,beta,WN);
  39. }
  40. template <
  41. typename DerivedP,
  42. typename DerivedN,
  43. typename DerivedQ,
  44. typename DerivedWN>
  45. IGL_INLINE void igl::copyleft::cgal::fast_winding_number(
  46. const Eigen::MatrixBase<DerivedP>& P,
  47. const Eigen::MatrixBase<DerivedN>& N,
  48. const Eigen::MatrixBase<DerivedQ>& Q,
  49. Eigen::PlainObjectBase<DerivedWN>& WN)
  50. {
  51. fast_winding_number(P,N,Q,2,2.0,WN);
  52. }
  53. #ifdef IGL_STATIC_LIBRARY
  54. // Explicit template instantiation
  55. template void igl::copyleft::cgal::fast_winding_number<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, double, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, int, double, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  56. #endif