edge_flaps.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@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_EDGE_FLAPS_H
  9. #define IGL_EDGE_FLAPS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. namespace igl
  13. {
  14. // Determine "edge flaps": two faces on either side of a unique edge (assumes
  15. // edge-manifold mesh)
  16. //
  17. // Inputs:
  18. // F #F by 3 list of face indices
  19. // uE #uE by 2 list of edge indices into V.
  20. // EMAP #F*3 list of indices into uE, mapping each directed edge to unique
  21. // unique edge in uE
  22. // Outputs:
  23. // EF #E by 2 list of edge flaps, EF(e,0)=f means e=(i-->j) is the edge of
  24. // F(f,:) opposite the vth corner, where EI(e,0)=v. Similarly EF(e,1) "
  25. // e=(j->i)
  26. // EI #E by 2 list of edge flap corners (see above).
  27. //
  28. // See also: unique_edge_map
  29. //
  30. // TODO: This seems to be a duplicate of edge_topology.h
  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. IGL_INLINE void edge_flaps(
  38. const Eigen::MatrixXi & F,
  39. const Eigen::MatrixXi & uE,
  40. const Eigen::VectorXi & EMAP,
  41. Eigen::MatrixXi & EF,
  42. Eigen::MatrixXi & EI);
  43. // Only faces as input
  44. IGL_INLINE void edge_flaps(
  45. const Eigen::MatrixXi & F,
  46. Eigen::MatrixXi & uE,
  47. Eigen::VectorXi & EMAP,
  48. Eigen::MatrixXi & EF,
  49. Eigen::MatrixXi & EI);
  50. }
  51. #ifndef IGL_STATIC_LIBRARY
  52. # include "edge_flaps.cpp"
  53. #endif
  54. #endif