outer_element.h 4.2 KB

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