order_facets_around_edge.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. //
  9. #ifndef ORDER_FACETS_AROUND_EDGE_H
  10. #define ORDER_FACETS_AROUND_EDGE_H
  11. #include "../igl_inline.h"
  12. namespace igl {
  13. namespace cgal {
  14. // Given a directed edge, sort its adjacent faces. Assuming the
  15. // directed edge is (s, d). Sort the adjacent faces clockwise around the
  16. // axis (d - s), i.e. left-hand rule. An adjacent face is consistently
  17. // oriented if it contains (d, s) as a directed edge.
  18. //
  19. // For overlapping faces, break the tie using signed face index, smaller
  20. // signed index comes before the larger signed index. Signed index is
  21. // computed as (consistent? 1:-1) * (face_index + 1).
  22. //
  23. // Inputs:
  24. // V #V by 3 list of vertices.
  25. // F #F by 3 list of faces
  26. // s Index of source vertex.
  27. // d Index of desination vertex.
  28. // adj_faces List of adjacent face signed indices.
  29. //
  30. // Output:
  31. // order List of face indices that orders adjacent faces around
  32. // edge (s, d) clockwise.
  33. template<
  34. typename DerivedV,
  35. typename DerivedF,
  36. typename DerivedI >
  37. IGL_INLINE
  38. void order_facets_around_edge(
  39. const Eigen::PlainObjectBase<DerivedV>& V,
  40. const Eigen::PlainObjectBase<DerivedF>& F,
  41. size_t s, size_t d,
  42. const std::vector<int>& adj_faces,
  43. Eigen::PlainObjectBase<DerivedI>& order);
  44. }
  45. }
  46. #ifndef IGL_STATIC_LIBRARY
  47. #include "order_facets_around_edge.cpp"
  48. #endif
  49. #endif