fast_winding_number.cpp 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. typedef typename Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic>
  24. RealMatrix;
  25. std::vector<std::vector<int> > point_indices;
  26. Eigen::Matrix<int,Eigen::Dynamic,8> CH;
  27. Eigen::Matrix<real,Eigen::Dynamic,3> CN;
  28. Eigen::Matrix<real,Eigen::Dynamic,1> W;
  29. Eigen::MatrixXi I;
  30. Eigen::Matrix<real,Eigen::Dynamic,1> A;
  31. octree(P,point_indices,CH,CN,W);
  32. knn(P,21,point_indices,CH,CN,W,I);
  33. point_areas(P,I,N,A);
  34. Eigen::Matrix<real,Eigen::Dynamic,Eigen::Dynamic> EC;
  35. Eigen::Matrix<real,Eigen::Dynamic,3> CM;
  36. Eigen::Matrix<real,Eigen::Dynamic,1> R;
  37. igl::fast_winding_number(
  38. P,N,A,point_indices,CH,expansion_order,CM,R,EC);
  39. igl::fast_winding_number(
  40. P,N,A,point_indices,CH,CM,R,EC,Q,beta,WN);
  41. }
  42. template <
  43. typename DerivedP,
  44. typename DerivedN,
  45. typename DerivedQ,
  46. typename DerivedWN>
  47. IGL_INLINE void igl::copyleft::cgal::fast_winding_number(
  48. const Eigen::MatrixBase<DerivedP>& P,
  49. const Eigen::MatrixBase<DerivedN>& N,
  50. const Eigen::MatrixBase<DerivedQ>& Q,
  51. Eigen::PlainObjectBase<DerivedWN>& WN)
  52. {
  53. fast_winding_number(P,N,Q,2,2.0,WN);
  54. }
  55. #ifdef IGL_STATIC_LIBRARY
  56. // Explicit template instantiation
  57. 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> >&);
  58. #endif