outer_element.h 4.0 KB

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