propagate_winding_numbers.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef IGL_CGAL_PROPAGATE_WINDING_NUMBERS_H
  2. #define IGL_CGAL_PROPAGATE_WINDING_NUMBERS_H
  3. #include "../igl_inline.h"
  4. #include <Eigen/Core>
  5. #include <vector>
  6. namespace igl {
  7. namespace cgal {
  8. // Computer winding number on each side of each patch.
  9. //
  10. // Inputs:
  11. // V #V by 3 list of vertices.
  12. // F #F by 3 list of trinalges.
  13. // uE #uE by 2 list of undirected edges.
  14. // uE2E #uE list of lists mapping each undirected edge to directed
  15. // edges.
  16. // C #P list of component indices.
  17. // P #F list of patch indices.
  18. // intersection_curves A list of non-manifold curves that separates
  19. // the mesh into patches.
  20. //
  21. // Outputs:
  22. // patch_W #P by k*2 list of winding numbers on each side of a
  23. // patch for each component.
  24. template<
  25. typename DerivedV,
  26. typename DerivedF,
  27. typename DeriveduE,
  28. typename uE2EType,
  29. typename DerivedC,
  30. typename DerivedP,
  31. typename DerivedW >
  32. IGL_INLINE bool propagate_winding_numbers_single_component_patch_wise(
  33. const Eigen::PlainObjectBase<DerivedV>& V,
  34. const Eigen::PlainObjectBase<DerivedF>& F,
  35. const Eigen::PlainObjectBase<DeriveduE>& uE,
  36. const std::vector<std::vector<uE2EType> >& uE2E,
  37. const Eigen::PlainObjectBase<DerivedC>& C,
  38. const Eigen::PlainObjectBase<DerivedP>& P,
  39. const std::vector<std::vector<size_t> >& intersection_curves,
  40. Eigen::PlainObjectBase<DerivedW>& patch_W);
  41. // Compute winding number on each side of the face.
  42. //
  43. // This method assumes the input mesh (V, F, I) forms a single connected
  44. // component.
  45. //
  46. // Inputs:
  47. // V #V by 3 list of vertex positions.
  48. // F #F by 3 list of triangle indices into V.
  49. // C #F list of effective face indices ranging from 0 to k-1.
  50. //
  51. // Output:
  52. // W #F by 2*k list of winding numbers. W(i,2*j) is the winding
  53. // number of submesh j on the positive side of facet i, and
  54. // W(i, 2*j+1) is the winding number of submesh j on the negative
  55. // side of facet i.
  56. //
  57. // Returns:
  58. // True iff integer winding number can be consistently assigned.
  59. template<
  60. typename DerivedV,
  61. typename DerivedF,
  62. typename DerivedC,
  63. typename DerivedW>
  64. IGL_INLINE bool propagate_winding_numbers_single_component(
  65. const Eigen::PlainObjectBase<DerivedV>& V,
  66. const Eigen::PlainObjectBase<DerivedF>& F,
  67. const Eigen::PlainObjectBase<DerivedC>& C,
  68. Eigen::PlainObjectBase<DerivedW>& W);
  69. // Compute the winding number on each side of the face.
  70. // This method assumes the input mesh (V, F) forms a single connected
  71. // component.
  72. //
  73. // Inputs:
  74. // V #V by 3 list of vertex positions.
  75. // F #F by 3 list of triangle indices into V.
  76. //
  77. // Output:
  78. // W #F by 2 list of winding numbers. W(i,0) is the winding number
  79. // on the positive side of facet i, and W(i, 1) is the winding
  80. // number on the negative side of facet I[i].
  81. template<
  82. typename DerivedV,
  83. typename DerivedF,
  84. typename DerivedW>
  85. IGL_INLINE bool propagate_winding_numbers_single_component(
  86. const Eigen::PlainObjectBase<DerivedV>& V,
  87. const Eigen::PlainObjectBase<DerivedF>& F,
  88. Eigen::PlainObjectBase<DerivedW>& W);
  89. // Compute winding number on each side of the face. The input mesh
  90. // could contain multiple connected components. The input mesh must
  91. // representa the boundary of a valid 3D volume, which means it is
  92. // closed, consistently oriented and induces integer winding numbers.
  93. //
  94. // Inputs:
  95. // V #V by 3 list of vertex positions.
  96. // F #F by 3 list of triangle indices into V.
  97. // C #F list of facet labels.
  98. //
  99. // Output:
  100. // W #I by 2 list of winding numbers. W(i,0) is the winding number
  101. // on the positive side of facet I[i], and W(i, 1) is the winding
  102. // number on the negative side of facet I[i].
  103. template<
  104. typename DerivedV,
  105. typename DerivedF,
  106. typename DerivedL,
  107. typename DerivedW>
  108. IGL_INLINE void propagate_winding_numbers(
  109. const Eigen::PlainObjectBase<DerivedV>& V,
  110. const Eigen::PlainObjectBase<DerivedF>& F,
  111. const Eigen::PlainObjectBase<DerivedL>& labels,
  112. Eigen::PlainObjectBase<DerivedW>& W);
  113. }
  114. }
  115. #ifndef IGL_STATIC_LIBRARY
  116. # include "propagate_winding_numbers.cpp"
  117. #endif
  118. #endif