outer_facet.h 2.0 KB

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