flip_edge.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. namespace igl
  13. {
  14. // Flip an edge in a triangle mesh. The edge specified by uei must have
  15. // exactly **two** adjacent faces. Violation will result in exception.
  16. // Another warning: edge flipping could convert manifold mesh into
  17. // non-manifold.
  18. //
  19. // Inputs:
  20. // F #F by 3 list of triangles.
  21. // E #F*3 by 2 list of all of directed edges
  22. // uE #uE by 2 list of unique undirected edges
  23. // EMAP #F*3 list of indices into uE, mapping each directed edge to unique
  24. // undirected edge
  25. // uE2E #uE list of lists of indices into E of coexisting edges
  26. // ue index into uE the edge to be flipped.
  27. //
  28. // Output:
  29. // Updated F, E, uE, EMAP and uE2E.
  30. template <
  31. typename DerivedF,
  32. typename DerivedE,
  33. typename DeriveduE,
  34. typename DerivedEMAP,
  35. typename uE2EType>
  36. IGL_INLINE void flip_edge(
  37. Eigen::PlainObjectBase<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. const size_t uei);
  43. }
  44. #ifndef IGL_STATIC_LIBRARY
  45. # include "flip_edge.cpp"
  46. #endif
  47. #endif