outer_facet.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan 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_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. // Precondition: 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. // funciton is more robust because it does not rely on facet normals.
  28. //
  29. // Inputs:
  30. // V #V by 3 list of vertex positions
  31. // F #F by 3 list of triangle indices into V
  32. // I #I list of facets to consider
  33. // Outputs:
  34. // f Index of the outer facet.
  35. // flipped true iff the normal of f points inwards.
  36. template<
  37. typename DerivedV,
  38. typename DerivedF,
  39. typename DerivedI,
  40. typename IndexType
  41. >
  42. IGL_INLINE void outer_facet(
  43. const Eigen::PlainObjectBase<DerivedV> & V,
  44. const Eigen::PlainObjectBase<DerivedF> & F,
  45. const Eigen::PlainObjectBase<DerivedI> & I,
  46. IndexType & f,
  47. bool & flipped);
  48. // Find a facet that is reachable from infinity without crossing any faces.
  49. // Such facet is called "outer facet."
  50. //
  51. // Precondition: The input mesh must have all self-intersection resolved.
  52. // I.e there is no duplicated vertices, no overlapping edge and no
  53. // intersecting faces (the only exception is there could be topologically
  54. // duplicated faces). See cgal::remesh_self_intersections.h for how to
  55. // obtain such input.
  56. //
  57. // Inputs:
  58. // V #V by 3 list of vertex positions
  59. // F #F by 3 list of triangle indices into V
  60. // N #N by 3 list of face normals
  61. // I #I list of facets to consider
  62. // Outputs:
  63. // f Index of the outer facet.
  64. // flipped true iff the normal of f points inwards.
  65. template<
  66. typename DerivedV,
  67. typename DerivedF,
  68. typename DerivedN,
  69. typename DerivedI,
  70. typename IndexType
  71. >
  72. IGL_INLINE void outer_facet(
  73. const Eigen::PlainObjectBase<DerivedV> & V,
  74. const Eigen::PlainObjectBase<DerivedF> & F,
  75. const Eigen::PlainObjectBase<DerivedN> & N,
  76. const Eigen::PlainObjectBase<DerivedI> & I,
  77. IndexType & f,
  78. bool & flipped);
  79. }
  80. }
  81. }
  82. #ifndef IGL_STATIC_LIBRARY
  83. # include "outer_facet.cpp"
  84. #endif
  85. #endif