edges_to_path.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef IGL_EDGES_TO_PATH_H
  2. #define IGL_EDGES_TO_PATH_H
  3. #include "igl_inline.h"
  4. #include <Eigen/Core>
  5. namespace igl
  6. {
  7. // EDGES_TO_PATH Given a set of undirected, unique edges such that all form a
  8. // single connected compoent with exactly 0 or 2 nodes with valence =1,
  9. // determine the/a path visiting all nodes.
  10. //
  11. // Inputs:
  12. // E #E by 2 list of undirected edges
  13. // Outputs:
  14. // I #E+1 list of nodes in order tracing the chain (loop), if the output
  15. // is a loop then I(1) == I(end)
  16. // J #I-1 list of indices into E of edges tracing I
  17. // K #I-1 list of indices into columns of E {1,2} so that K(i) means that
  18. // E(i,K(i)) comes before the other (i.e., E(i,3-K(i)) ). This means that
  19. // I(i) == E(J(i),K(i)) for i<#I, or
  20. // I == E(sub2ind(size(E),J([1:end end]),[K;3-K(end)]))))
  21. //
  22. template <
  23. typename DerivedE,
  24. typename DerivedI,
  25. typename DerivedJ,
  26. typename DerivedK>
  27. IGL_INLINE void edges_to_path(
  28. const Eigen::MatrixBase<DerivedE> & E,
  29. Eigen::PlainObjectBase<DerivedI> & I,
  30. Eigen::PlainObjectBase<DerivedJ> & J,
  31. Eigen::PlainObjectBase<DerivedK> & K);
  32. }
  33. #ifndef IGL_STATIC_LIBRARY
  34. # include "edges_to_path.cpp"
  35. #endif
  36. #endif