order_facets_around_edge.h 2.0 KB

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