outer_facet.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <qnzhou@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_FACET_H
  9. #define IGL_CGAL_OUTER_FACET_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. namespace cgal
  15. {
  16. // Find a facet that is reachable from infinity without crossing any faces.
  17. // Such facet is called "outer facet."
  18. //
  19. // Precondition: The input mesh must have all self-intersection resolved. I.e
  20. // there is no duplicated vertices, no overlapping edge and no intersecting
  21. // faces (the only exception is there could be topologically duplicated faces).
  22. // See cgal::remesh_self_intersections.h for how to obtain such input.
  23. //
  24. // This function differ from igl::outer_facet() in the fact this
  25. // funciton is more robust because it does not rely on facet normals.
  26. //
  27. // Inputs:
  28. // V #V by 3 list of vertex positions
  29. // F #F by 3 list of triangle indices into V
  30. // I #I list of facets to consider
  31. // Outputs:
  32. // f Index of the outer facet.
  33. // flipped true iff the normal of f points inwards.
  34. template<
  35. typename DerivedV,
  36. typename DerivedF,
  37. typename DerivedI,
  38. typename IndexType
  39. >
  40. IGL_INLINE void outer_facet(
  41. const Eigen::PlainObjectBase<DerivedV> & V,
  42. const Eigen::PlainObjectBase<DerivedF> & F,
  43. const Eigen::PlainObjectBase<DerivedI> & I,
  44. IndexType & f,
  45. bool & flipped);
  46. }
  47. }
  48. #ifndef IGL_STATIC_LIBRARY
  49. # include "outer_facet.cpp"
  50. #endif
  51. #endif