edge_flaps.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <[email protected]>
  4. // Copyright (C) 2020 Alec Jacobson <[email protected]>
  5. //
  6. // This Source Code Form is subject to the terms of the Mozilla Public License
  7. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  8. // obtain one at http://mozilla.org/MPL/2.0/.
  9. #ifndef IGL_EDGE_FLAPS_H
  10. #define IGL_EDGE_FLAPS_H
  11. #include "igl_inline.h"
  12. #include <Eigen/Core>
  13. namespace igl
  14. {
  15. /// Determine "edge flaps": two faces on either side of a unique edge (assumes
  16. /// edge-manifold mesh)
  17. ///
  18. /// @param[in] F #F by 3 list of face indices
  19. /// @param[in] uE #uE by 2 list of edge indices into V.
  20. /// @param[in] EMAP #F*3 list of indices into uE, mapping each directed edge to unique
  21. /// unique edge in uE
  22. /// @param[out] EF #E by 2 list of edge flaps, EF(e,0)=f means e=(i-->j) is the edge of
  23. /// F(f,:) opposite the vth corner, where EI(e,0)=v. Similarly EF(e,1) "
  24. /// e=(j->i)
  25. /// @param[out] EI #E by 2 list of edge flap corners (see above).
  26. ///
  27. /// \see unique_edge_map
  28. ///
  29. /// \note This seems to be a duplicate of edge_topology.h
  30. /// \code{cpp}
  31. /// igl::edge_topology(V,F,etEV,etFE,etEF);
  32. /// igl::edge_flaps(F,efE,efEMAP,efEF,efEI);
  33. /// [~,I] = sort(efE,2)
  34. /// all( efE(sub2ind(size(efE),repmat(1:size(efE,1),2,1)',I)) == etEV )
  35. /// all( efEF(sub2ind(size(efE),repmat(1:size(efE,1),2,1)',I)) == etEF )
  36. /// all(efEMAP(sub2ind(size(F),repmat(1:size(F,1),3,1)',repmat([1 2 3],size(F,1),1))) == etFE(:,[2 3 1]))
  37. /// \endcode
  38. template <
  39. typename DerivedF,
  40. typename DeriveduE,
  41. typename DerivedEMAP,
  42. typename DerivedEF,
  43. typename DerivedEI>
  44. IGL_INLINE void edge_flaps(
  45. const Eigen::MatrixBase<DerivedF> & F,
  46. const Eigen::MatrixBase<DeriveduE> & uE,
  47. const Eigen::MatrixBase<DerivedEMAP> & EMAP,
  48. Eigen::PlainObjectBase<DerivedEF> & EF,
  49. Eigen::PlainObjectBase<DerivedEI> & EI);
  50. /// \overload
  51. template <
  52. typename DerivedF,
  53. typename DeriveduE,
  54. typename DerivedEMAP,
  55. typename DerivedEF,
  56. typename DerivedEI>
  57. IGL_INLINE void edge_flaps(
  58. const Eigen::MatrixBase<DerivedF> & F,
  59. Eigen::PlainObjectBase<DeriveduE> & uE,
  60. Eigen::PlainObjectBase<DerivedEMAP> & EMAP,
  61. Eigen::PlainObjectBase<DerivedEF> & EF,
  62. Eigen::PlainObjectBase<DerivedEI> & EI);
  63. }
  64. #ifndef IGL_STATIC_LIBRARY
  65. # include "edge_flaps.cpp"
  66. #endif
  67. #endif