outer_facet.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <[email protected]>
  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. /// \pre 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. /// function is more robust because it does not rely on facet normals.
  28. ///
  29. /// @param[in] V #V by 3 list of vertex positions
  30. /// @param[in] F #F by 3 list of triangle indices into V
  31. /// @param[in] I #I list of facets to consider
  32. /// @param[in] N #N by 3 list of face normals
  33. /// @param[out] f Index of the outer facet.
  34. /// @param[out] flipped true iff the normal of f points inwards.
  35. template<
  36. typename DerivedV,
  37. typename DerivedF,
  38. typename DerivedN,
  39. typename DerivedI,
  40. typename IndexType
  41. >
  42. IGL_INLINE void outer_facet(
  43. const Eigen::MatrixBase<DerivedV> & V,
  44. const Eigen::MatrixBase<DerivedF> & F,
  45. const Eigen::MatrixBase<DerivedN> & N,
  46. const Eigen::MatrixBase<DerivedI> & I,
  47. IndexType & f,
  48. bool & flipped);
  49. /// \overload
  50. template<
  51. typename DerivedV,
  52. typename DerivedF,
  53. typename DerivedI,
  54. typename IndexType
  55. >
  56. IGL_INLINE void outer_facet(
  57. const Eigen::MatrixBase<DerivedV> & V,
  58. const Eigen::MatrixBase<DerivedF> & F,
  59. const Eigen::MatrixBase<DerivedI> & I,
  60. IndexType & f,
  61. bool & flipped);
  62. }
  63. }
  64. }
  65. #ifndef IGL_STATIC_LIBRARY
  66. # include "outer_facet.cpp"
  67. #endif
  68. #endif