outer_element.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. }
  76. }
  77. }
  78. #ifndef IGL_STATIC_LIBRARY
  79. # include "outer_element.cpp"
  80. #endif
  81. #endif