fast_winding_number.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef IGL_COPYLEFT_CGAL_FAST_WINDING_NUMBER
  2. #define IGL_COPYLEFT_CGAL_FAST_WINDING_NUMBER
  3. #include "../../igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <vector>
  6. namespace igl
  7. {
  8. // Evaluate the fast winding number for point data, without known areas. The
  9. // areas are calculated using igl::knn and igl::copyleft::cgal::point_areas.
  10. //
  11. // This function performes the precomputation and evaluation all in one.
  12. // If you need to acess the precomuptation for repeated evaluations, use the
  13. // two functions designed for exposed precomputation, which are the first two
  14. // functions see in igl/fast_winding_number.h
  15. //
  16. // Inputs:
  17. // P #P by 3 list of point locations
  18. // N #P by 3 list of point normals
  19. // Q #Q by 3 list of query points for the winding number
  20. // beta This is a Barnes-Hut style accuracy term that separates near feild
  21. // from far field. The higher the beta, the more accurate and slower
  22. // the evaluation. We reccommend using a beta value of 2.
  23. // expansion_order the order of the taylor expansion. We support 0,1,2.
  24. // Outputs:
  25. // WN #Q by 1 list of windinng number values at each query point
  26. //
  27. template <typename DerivedP, typename DerivedN, typename DerivedQ,
  28. typename BetaType, typename DerivedWN>
  29. IGL_INLINE void fast_winding_number(const Eigen::MatrixBase<DerivedP>& P,
  30. const Eigen::MatrixBase<DerivedN>& N,
  31. const Eigen::MatrixBase<DerivedQ>& Q,
  32. const int expansion_order,
  33. const BetaType beta,
  34. Eigen::PlainObjectBase<DerivedWN>& WN
  35. );
  36. // Evaluate the fast winding number for point data, without known areas. The
  37. // areas are calculated using igl::knn and
  38. // igl::point_areas. This function uses the default expansion
  39. // order and beta (both are set to 2).
  40. //
  41. // This function performes the precomputation and evaluation all in one.
  42. // If you need to acess the precomuptation for repeated evaluations, use the
  43. // two functions designed for exposed precomputation (described above).
  44. // Inputs:
  45. // P #P by 3 list of point locations
  46. // N #P by 3 list of point normals
  47. // Q #Q by 3 list of query points for the winding number
  48. // Outputs:
  49. // WN #Q by 1 list of windinng number values at each query point
  50. //
  51. template <typename DerivedP, typename DerivedN, typename DerivedQ,
  52. typename DerivedWN>
  53. IGL_INLINE void fast_winding_number(const Eigen::MatrixBase<DerivedP>& P,
  54. const Eigen::MatrixBase<DerivedN>& N,
  55. const Eigen::MatrixBase<DerivedQ>& Q,
  56. Eigen::PlainObjectBase<DerivedWN>& WN
  57. );
  58. }
  59. #ifndef IGL_STATIC_LIBRARY
  60. # include "fast_winding_number.cpp"
  61. #endif
  62. #endif