outer_hull.h 2.3 KB

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