unique_edge_map.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@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. #ifndef IGL_UNIQUE_EDGE_MAP_H
  9. #define IGL_UNIQUE_EDGE_MAP_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <vector>
  13. namespace igl
  14. {
  15. // Construct relationships between facet "half"-(or rather "viewed")-edges E
  16. // to unique edges of the mesh seen as a graph.
  17. //
  18. // Inputs:
  19. // F #F by 3 list of simplices
  20. // Outputs:
  21. // E #F*3 by 2 list of all directed edges, such that E.row(f+#F*c) is the
  22. // edge opposite F(f,c)
  23. // uE #uE by 2 list of unique undirected edges
  24. // EMAP #F*3 list of indices into uE, mapping each directed edge to unique
  25. // undirected edge so that uE(EMAP(f+#F*c)) is the unique edge
  26. // corresponding to E.row(f+#F*c)
  27. // uE2E #uE list of lists of indices into E of coexisting edges, so that
  28. // E.row(uE2E[i][j]) corresponds to uE.row(i) for all j in
  29. // 0..uE2E[i].size()-1.
  30. template <
  31. typename DerivedF,
  32. typename DerivedE,
  33. typename DeriveduE,
  34. typename DerivedEMAP,
  35. typename uE2EType>
  36. IGL_INLINE void unique_edge_map(
  37. const Eigen::MatrixBase<DerivedF> & F,
  38. Eigen::PlainObjectBase<DerivedE> & E,
  39. Eigen::PlainObjectBase<DeriveduE> & uE,
  40. Eigen::PlainObjectBase<DerivedEMAP> & EMAP,
  41. std::vector<std::vector<uE2EType> > & uE2E);
  42. }
  43. #ifndef IGL_STATIC_LIBRARY
  44. # include "unique_edge_map.cpp"
  45. #endif
  46. #endif