edge_collapse_is_valid.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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_EDGE_COLLAPSE_IS_VALID_H
  9. #define IGL_EDGE_COLLAPSE_IS_VALID_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. /// Tests whether collapsing exactly two faces and exactly 3 edges from E (e
  16. /// and one side of each face gets collapsed to the other) will result in a
  17. /// mesh with the same topology. Assumes (V,F) is a closed manifold mesh
  18. /// (except for previouslly collapsed faces which should be set to:
  19. /// [IGL_COLLAPSE_EDGE_NULL IGL_COLLAPSE_EDGE_NULL IGL_COLLAPSE_EDGE_NULL].
  20. ///
  21. /// @param[in] e index into E of edge to try to collapse. E(e,:) = [s d] or [d s] so
  22. /// that s<d, then d is collapsed to s.
  23. /// @param[in] F #F by 3 list of face indices into V.
  24. /// @param[in] E #E by 2 list of edge indices into V.
  25. /// @param[in] EMAP #F*3 list of indices into E, mapping each directed edge to unique
  26. /// unique edge in E
  27. /// @param[in] EF #E by 2 list of edge flaps, EF(e,0)=f means e=(i-->j) is the edge of
  28. /// F(f,:) opposite the vth corner, where EI(e,0)=v. Similarly EF(e,1) "
  29. /// e=(j->i)
  30. /// @param[in] EI #E by 2 list of edge flap corners (see above).
  31. /// @return true if edge collapse is valid
  32. template <
  33. typename DerivedF,
  34. typename DerivedE,
  35. typename DerivedEMAP,
  36. typename DerivedEF,
  37. typename DerivedEI>
  38. IGL_INLINE bool edge_collapse_is_valid(
  39. const int e,
  40. const Eigen::MatrixBase<DerivedF> & F,
  41. const Eigen::MatrixBase<DerivedE> & E,
  42. const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  43. const Eigen::MatrixBase<DerivedEF> & EF,
  44. const Eigen::MatrixBase<DerivedEI> & EI);
  45. /// Tests whether collapsing exactly two faces and exactly 3 edges from E (e
  46. /// and one side of each face gets collapsed to the other) will result in a
  47. /// mesh with the same topology.
  48. ///
  49. /// @param[in] Nsv #Nsv list of "next" vertices circulating around starting vertex of
  50. /// edge
  51. /// @param[in] Ndv #Ndv list of "next" vertices circulating around destination vertex of
  52. /// edge
  53. /// @param[out] Nsv (side-effect: sorted by value)
  54. /// @param[out] Ndv (side-effect: sorted by value)
  55. /// @return true iff edge collapse is valid
  56. ///
  57. /// \see circulation
  58. IGL_INLINE bool edge_collapse_is_valid(
  59. /*const*/ std::vector<int> & Nsv,
  60. /*const*/ std::vector<int> & Ndv);
  61. }
  62. #ifndef IGL_STATIC_LIBRARY
  63. # include "edge_collapse_is_valid.cpp"
  64. #endif
  65. #endif