edges.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2013 Alec Jacobson <[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_EDGES_H
  9. #define IGL_EDGES_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <Eigen/Sparse>
  13. namespace igl
  14. {
  15. /// Constructs a list of unique edges represented in a given mesh (V,F)
  16. ///
  17. /// @param[in] F #F by (3|4) list of mesh simplex indices
  18. /// @param[out] E #E by 2 list of edges in no particular order
  19. ///
  20. /// \see adjacency_matrix
  21. template <typename DerivedF, typename DerivedE>
  22. IGL_INLINE void edges(
  23. const Eigen::MatrixBase<DerivedF> & F,
  24. Eigen::PlainObjectBase<DerivedE> & E);
  25. /// Constructs a list of unique edges represented in a given polygon mesh.
  26. ///
  27. /// @param[in] I #I vectorized list of polygon corner indices into rows of some matrix V
  28. /// @param[in] C #polygons+1 list of cumulative polygon sizes so that C(i+1)-C(i) =
  29. /// size of the ith polygon, and so I(C(i)) through I(C(i+1)-1) are the
  30. /// indices of the ith polygon
  31. /// @param[out] E #E by 2 list of edges in no particular order
  32. template <typename DerivedI, typename DerivedC, typename DerivedE>
  33. IGL_INLINE void edges(
  34. const Eigen::MatrixBase<DerivedI> & I,
  35. const Eigen::MatrixBase<DerivedC> & C,
  36. Eigen::PlainObjectBase<DerivedE> & E);
  37. /// Constructs a list of unique edges represented in a given adjacency matrix.
  38. ///
  39. /// @param[in] A #V by #V symmetric adjacency matrix
  40. /// @param[out] E #E by 2 list of edges in no particular order
  41. template <typename T, typename DerivedE>
  42. IGL_INLINE void edges(
  43. const Eigen::SparseMatrix<T> & A,
  44. Eigen::PlainObjectBase<DerivedE> & E);
  45. }
  46. #ifndef IGL_STATIC_LIBRARY
  47. # include "edges.cpp"
  48. #endif
  49. #endif