outer_hull.h 2.4 KB

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