outer_hull.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_COPYLEFT_CGAL_OUTER_HULL_H
  9. #define IGL_COPYLEFT_CGAL_OUTER_HULL_H
  10. #include "../../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace copyleft
  15. {
  16. namespace cgal
  17. {
  18. // Compute the "outer hull" of a piecewise constant winding number induce
  19. // triangle mesh (V,F).
  20. //
  21. // Inputs:
  22. // V #V by 3 list of vertex positions
  23. // F #F by 3 list of triangle indices into V
  24. // Outputs:
  25. // HV #HV by 3 list of output vertex positions
  26. // HF #HF by 3 list of output triangle indices into HV
  27. // J #HF list of indices into F
  28. // flip #HF list of whether facet was flipped when added to HF
  29. //
  30. template <
  31. typename DerivedV,
  32. typename DerivedF,
  33. typename DerivedHV,
  34. typename DerivedHF,
  35. typename DerivedJ,
  36. typename Derivedflip>
  37. IGL_INLINE void outer_hull(
  38. const Eigen::PlainObjectBase<DerivedV> & V,
  39. const Eigen::PlainObjectBase<DerivedF> & F,
  40. Eigen::PlainObjectBase<DerivedHV> & HV,
  41. Eigen::PlainObjectBase<DerivedHF> & HF,
  42. Eigen::PlainObjectBase<DerivedJ> & J,
  43. Eigen::PlainObjectBase<Derivedflip> & flip);
  44. // Compute the "outer hull" of a potentially non-manifold mesh (V,F) whose
  45. // intersections have been "resolved" (e.g. using `cork` or
  46. // `igl::copyleft::cgal::selfintersect`). The outer hull is defined to be all facets
  47. // (regardless of orientation) for which there exists some path from infinity
  48. // to the face without intersecting any other facets. For solids, this is the
  49. // surface of the solid. In general this includes any thin "wings" or
  50. // "flaps". This implementation largely follows Section 3.6 of "Direct
  51. // repair of self-intersecting meshes" [Attene 2014].
  52. //
  53. // Note: This doesn't require the input mesh to be piecewise constant
  54. // winding number, but won't handle multiple non-nested connected
  55. // components.
  56. //
  57. // Inputs:
  58. // V #V by 3 list of vertex positions
  59. // F #F by 3 list of triangle indices into V
  60. // Outputs:
  61. // G #G by 3 list of output triangle indices into V
  62. // J #G list of indices into F
  63. // flip #F list of whether facet was added to G **and** flipped orientation
  64. // (false for faces not added to G)
  65. template <
  66. typename DerivedV,
  67. typename DerivedF,
  68. typename DerivedG,
  69. typename DerivedJ,
  70. typename Derivedflip>
  71. IGL_INLINE void outer_hull_legacy(
  72. const Eigen::PlainObjectBase<DerivedV> & V,
  73. const Eigen::PlainObjectBase<DerivedF> & F,
  74. Eigen::PlainObjectBase<DerivedG> & G,
  75. Eigen::PlainObjectBase<DerivedJ> & J,
  76. Eigen::PlainObjectBase<Derivedflip> & flip);
  77. }
  78. }
  79. }
  80. #ifndef IGL_STATIC_LIBRARY
  81. # include "outer_hull.cpp"
  82. #endif
  83. #endif