outer_hull.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef IGL_OUTER_HULL_H
  2. #define IGL_OUTER_HULL_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // Compute the "outer hull" of a potentially non-manifold mesh (V,F) whose
  8. // intersections have been "resolved" (e.g. using `cork` or
  9. // `igl::selfintersect`). The outer hull is defined to be all facets
  10. // (regardless of orientation) for which there exists some path from infinity
  11. // to the face without intersecting any other facets. For solids, this is the
  12. // surface of the solid. In general this includes any thin "wings" or "flaps".
  13. // This implementation largely follows Section 3.6 of "Direct repair of
  14. // self-intersecting meshes" [Attene 2014].
  15. //
  16. // Inputs:
  17. // V #V by 3 list of vertex positions
  18. // F #F by 3 list of triangle indices into V
  19. // N #F by 3 list of per-face normals
  20. // Outputs:
  21. // G #G by 3 list of output triangle indices into V
  22. // J #G list of indices into F
  23. // flip #F list of whether facet was added to G **and** flipped orientation
  24. // (false for faces not added to G)
  25. template <
  26. typename DerivedV,
  27. typename DerivedF,
  28. typename DerivedN,
  29. typename DerivedG,
  30. typename DerivedJ,
  31. typename Derivedflip>
  32. IGL_INLINE void outer_hull(
  33. const Eigen::PlainObjectBase<DerivedV> & V,
  34. const Eigen::PlainObjectBase<DerivedF> & F,
  35. const Eigen::PlainObjectBase<DerivedN> & N,
  36. Eigen::PlainObjectBase<DerivedG> & G,
  37. Eigen::PlainObjectBase<DerivedJ> & J,
  38. Eigen::PlainObjectBase<Derivedflip> & flip);
  39. template <
  40. typename DerivedV,
  41. typename DerivedF,
  42. typename DerivedG,
  43. typename DerivedJ,
  44. typename Derivedflip>
  45. IGL_INLINE void outer_hull(
  46. const Eigen::PlainObjectBase<DerivedV> & V,
  47. const Eigen::PlainObjectBase<DerivedF> & F,
  48. Eigen::PlainObjectBase<DerivedG> & G,
  49. Eigen::PlainObjectBase<DerivedJ> & J,
  50. Eigen::PlainObjectBase<Derivedflip> & flip);
  51. template<
  52. typename Kernel,
  53. typename DerivedV,
  54. typename DerivedF,
  55. typename DerivedN,
  56. typename DerivedG,
  57. typename DerivedJ,
  58. typename Derivedflip>
  59. IGL_INLINE void outer_hull_exact(
  60. const Eigen::PlainObjectBase<DerivedV> & V,
  61. const Eigen::PlainObjectBase<DerivedF> & F,
  62. const Eigen::PlainObjectBase<DerivedN> & N,
  63. Eigen::PlainObjectBase<DerivedG> & G,
  64. Eigen::PlainObjectBase<DerivedJ> & J,
  65. Eigen::PlainObjectBase<Derivedflip> & flip);
  66. }
  67. #ifndef IGL_STATIC_LIBRARY
  68. # include "outer_hull.cpp"
  69. #endif
  70. #endif