edges_to_path.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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. /// 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. /// @param[in] E #E by 2 list of undirected edges
  12. /// @param[out] I #E+1 list of nodes in order tracing the chain (loop), if the output
  13. /// is a loop then I(1) == I(end)
  14. /// @param[out] J #I-1 list of indices into E of edges tracing I
  15. /// @param[out] K #I-1 list of indices into columns of E {0,1} so that K(i) means that
  16. /// E(i,K(i)) comes before the other (i.e., E(i,3-K(i)) ). This means that
  17. /// I(i) == E(J(i),K(i)) for i<#I, or
  18. /// I == E(sub2ind(size(E),J([1:end end]),[K;3-K(end)]))))
  19. ///
  20. template <
  21. typename DerivedE,
  22. typename DerivedI,
  23. typename DerivedJ,
  24. typename DerivedK>
  25. IGL_INLINE void edges_to_path(
  26. const Eigen::MatrixBase<DerivedE> & E,
  27. Eigen::PlainObjectBase<DerivedI> & I,
  28. Eigen::PlainObjectBase<DerivedJ> & J,
  29. Eigen::PlainObjectBase<DerivedK> & K);
  30. }
  31. #ifndef IGL_STATIC_LIBRARY
  32. # include "edges_to_path.cpp"
  33. #endif
  34. #endif