outer_element.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingan 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_OUTER_ELEMENT_H
  9. #define IGL_OUTER_ELEMENT_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. /// Find a vertex that is reachable from infinite without crossing any faces.
  15. /// Such vertex is called "outer vertex."
  16. ///
  17. /// Precondition: The input mesh must have all self-intersection resolved and
  18. /// no duplicated vertices. See cgal::remesh_self_intersections.h for how to
  19. /// obtain such input.
  20. ///
  21. /// @param[in] V #V by 3 list of vertex positions
  22. /// @param[in] F #F by 3 list of triangle indices into V
  23. /// @param[in] I #I list of facets to consider
  24. /// @param[out] v_index index of outer vertex
  25. /// @param[out] A #A list of facets incident to the outer vertex
  26. ///
  27. /// \fileinfo
  28. template <
  29. typename DerivedV,
  30. typename DerivedF,
  31. typename DerivedI,
  32. typename IndexType,
  33. typename DerivedA
  34. >
  35. IGL_INLINE void outer_vertex(
  36. const Eigen::MatrixBase<DerivedV> & V,
  37. const Eigen::MatrixBase<DerivedF> & F,
  38. const Eigen::MatrixBase<DerivedI> & I,
  39. IndexType & v_index,
  40. Eigen::PlainObjectBase<DerivedA> & A);
  41. /// Find an edge that is reachable from infinity without crossing any faces.
  42. /// Such edge is called "outer edge."
  43. ///
  44. /// Precondition: The input mesh must have all self-intersection resolved and
  45. /// no duplicated vertices. The correctness of the output depends on the fact
  46. /// that there is no edge overlap. See cgal::remesh_self_intersections.h for
  47. /// how to obtain such input.
  48. ///
  49. /// @param[in] V #V by 3 list of vertex positions
  50. /// @param[in] F #F by 3 list of triangle indices into V
  51. /// @param[in] I #I list of facets to consider
  52. /// @param[out] v1 index of the first end point of outer edge
  53. /// @param[out] v2 index of the second end point of outer edge
  54. /// @param[out] A #A list of facets incident to the outer edge
  55. ///
  56. /// \fileinfo
  57. template<
  58. typename DerivedV,
  59. typename DerivedF,
  60. typename DerivedI,
  61. typename IndexType,
  62. typename DerivedA
  63. >
  64. IGL_INLINE void outer_edge(
  65. const Eigen::MatrixBase<DerivedV> & V,
  66. const Eigen::MatrixBase<DerivedF> & F,
  67. const Eigen::MatrixBase<DerivedI> & I,
  68. IndexType & v1,
  69. IndexType & v2,
  70. Eigen::PlainObjectBase<DerivedA> & A);
  71. /// Find a facet that is reachable from infinity without crossing any faces.
  72. /// Such facet is called "outer facet."
  73. ///
  74. /// Precondition: The input mesh must have all self-intersection resolved. I.e
  75. /// there is no duplicated vertices, no overlapping edge and no intersecting
  76. /// faces (the only exception is there could be topologically duplicated faces).
  77. /// See cgal::remesh_self_intersections.h for how to obtain such input.
  78. ///
  79. /// @param[in] V #V by 3 list of vertex positions
  80. /// @param[in] F #F by 3 list of triangle indices into V
  81. /// @param[in] N #N by 3 list of face normals
  82. /// @param[in] I #I list of facets to consider
  83. /// @param[out] f Index of the outer facet.
  84. /// @param[out] flipped true iff the normal of f points inwards.
  85. ///
  86. /// \fileinfo
  87. template<
  88. typename DerivedV,
  89. typename DerivedF,
  90. typename DerivedN,
  91. typename DerivedI,
  92. typename IndexType
  93. >
  94. IGL_INLINE void outer_facet(
  95. const Eigen::MatrixBase<DerivedV> & V,
  96. const Eigen::MatrixBase<DerivedF> & F,
  97. const Eigen::MatrixBase<DerivedN> & N,
  98. const Eigen::MatrixBase<DerivedI> & I,
  99. IndexType & f,
  100. bool & flipped);
  101. }
  102. #ifndef IGL_STATIC_LIBRARY
  103. # include "outer_element.cpp"
  104. #endif
  105. #endif