edge_collapse_is_valid.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. IGL_INLINE bool edge_collapse_is_valid(
  33. const int e,
  34. const Eigen::MatrixXi & F,
  35. const Eigen::MatrixXi & E,
  36. const Eigen::VectorXi & EMAP,
  37. const Eigen::MatrixXi & EF,
  38. const Eigen::MatrixXi & EI);
  39. /// Tests whether collapsing exactly two faces and exactly 3 edges from E (e
  40. /// and one side of each face gets collapsed to the other) will result in a
  41. /// mesh with the same topology.
  42. ///
  43. /// @param[in] Nsv #Nsv list of "next" vertices circulating around starting vertex of
  44. /// edge
  45. /// @param[in] Ndv #Ndv list of "next" vertices circulating around destination vertex of
  46. /// edge
  47. /// @param[out] Nsv (side-effect: sorted by value)
  48. /// @param[out] Ndv (side-effect: sorted by value)
  49. /// @return true iff edge collapse is valid
  50. ///
  51. /// \see circulation
  52. IGL_INLINE bool edge_collapse_is_valid(
  53. /*const*/ std::vector<int> & Nsv,
  54. /*const*/ std::vector<int> & Ndv);
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "edge_collapse_is_valid.cpp"
  58. #endif
  59. #endif