flip_edge.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 Qingan Zhou <qnzhou@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_FLIP_EDGE_H
  9. #define IGL_FLIP_EDGE_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. // Flip an edge in a triangle mesh. The edge specified by uei must have
  16. // exactly **two** adjacent faces. Violation will result in exception.
  17. // Another warning: edge flipping could convert manifold mesh into
  18. // non-manifold.
  19. //
  20. // Inputs:
  21. // F #F by 3 list of triangles.
  22. // E #F*3 by 2 list of all of directed edges
  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
  26. // uE2E #uE list of lists of indices into E of coexisting edges
  27. // ue index into uE the edge to be flipped.
  28. //
  29. // Output:
  30. // Updated F, E, uE, EMAP and uE2E.
  31. template <
  32. typename DerivedF,
  33. typename DerivedE,
  34. typename DeriveduE,
  35. typename DerivedEMAP,
  36. typename uE2EType>
  37. IGL_INLINE void flip_edge(
  38. Eigen::PlainObjectBase<DerivedF> & F,
  39. Eigen::PlainObjectBase<DerivedE> & E,
  40. Eigen::PlainObjectBase<DeriveduE> & uE,
  41. Eigen::PlainObjectBase<DerivedEMAP> & EMAP,
  42. std::vector<std::vector<uE2EType> > & uE2E,
  43. const size_t uei);
  44. }
  45. #ifndef IGL_STATIC_LIBRARY
  46. # include "flip_edge.cpp"
  47. #endif
  48. #endif