outer_hull.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 potentially non-manifold mesh (V,F) whose
  19. // intersections have been "resolved" (e.g. using `cork` or
  20. // `igl::copyleft::cgal::selfintersect`). The outer hull is defined to be all facets
  21. // (regardless of orientation) for which there exists some path from infinity
  22. // to the face without intersecting any other facets. For solids, this is the
  23. // surface of the solid. In general this includes any thin "wings" or
  24. // "flaps". This implementation largely follows Section 3.6 of "Direct
  25. // repair of self-intersecting meshes" [Attene 2014].
  26. //
  27. // Inputs:
  28. // V #V by 3 list of vertex positions
  29. // F #F by 3 list of triangle indices into V
  30. // Outputs:
  31. // G #G by 3 list of output triangle indices into V
  32. // J #G list of indices into F
  33. // flip #F list of whether facet was added to G **and** flipped orientation
  34. // (false for faces not added to G)
  35. template <
  36. typename DerivedV,
  37. typename DerivedF,
  38. typename DerivedG,
  39. typename DerivedJ,
  40. typename Derivedflip>
  41. IGL_INLINE void outer_hull(
  42. const Eigen::PlainObjectBase<DerivedV> & V,
  43. const Eigen::PlainObjectBase<DerivedF> & F,
  44. Eigen::PlainObjectBase<DerivedG> & G,
  45. Eigen::PlainObjectBase<DerivedJ> & J,
  46. Eigen::PlainObjectBase<Derivedflip> & flip);
  47. }
  48. }
  49. }
  50. #ifndef IGL_STATIC_LIBRARY
  51. # include "outer_hull.cpp"
  52. #endif
  53. #endif