path_to_edges.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2019 Lawson Fulton [email protected]
  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_PATH_TO_EDGES_H
  9. #define IGL_PATH_TO_EDGES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. /// Given a path as an ordered list of N>=2 vertex indices I[0], I[1], ..., I[N-1]
  16. /// construct a list of edges [[I[0],I[1]], [I[1],I[2]], ..., [I[N-2], I[N-1]]]
  17. /// connecting each sequential pair of vertices.
  18. ///
  19. /// @param[in] I #I list of vertex indices
  20. /// @param[in] make_loop bool If true, include an edge connecting I[N-1] to I[0]
  21. /// @param[out] E #I-1 by 2 list of edges
  22. ///
  23. template <typename DerivedI, typename DerivedE>
  24. IGL_INLINE void path_to_edges(
  25. const Eigen::MatrixBase<DerivedI> & I,
  26. Eigen::PlainObjectBase<DerivedE> & E,
  27. bool make_loop=false);
  28. /// \overload
  29. template <typename Index, typename DerivedE>
  30. IGL_INLINE void path_to_edges(
  31. const std::vector<Index> & I,
  32. Eigen::PlainObjectBase<DerivedE> & E,
  33. bool make_loop=false);
  34. }
  35. #ifndef IGL_STATIC_LIBRARY
  36. # include "path_to_edges.cpp"
  37. #endif
  38. #endif