fast_winding_number.h 2.8 KB

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