fast_winding_number.cpp 2.2 KB

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