edge_flaps.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. // E #E by 2 list of edge indices into V.
  20. // EMAP #F*3 list of indices into E, mapping each directed edge to unique
  21. // unique edge in E
  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. // TODO: This seems to be a duplicate of edge_topology.h
  29. // igl::edge_topology(V,F,etEV,etFE,etEF);
  30. // igl::edge_flaps(F,efE,efEMAP,efEF,efEI);
  31. // [~,I] = sort(efE,2)
  32. // all( efE(sub2ind(size(efE),repmat(1:size(efE,1),2,1)',I)) == etEV )
  33. // all( efEF(sub2ind(size(efE),repmat(1:size(efE,1),2,1)',I)) == etEF )
  34. // all(efEMAP(sub2ind(size(F),repmat(1:size(F,1),3,1)',repmat([1 2 3],size(F,1),1))) == etFE(:,[2 3 1]))
  35. IGL_INLINE void edge_flaps(
  36. const Eigen::MatrixXi & F,
  37. const Eigen::MatrixXi & E,
  38. const Eigen::VectorXi & EMAP,
  39. Eigen::MatrixXi & EF,
  40. Eigen::MatrixXi & EI);
  41. // Only faces as input
  42. IGL_INLINE void edge_flaps(
  43. const Eigen::MatrixXi & F,
  44. Eigen::MatrixXi & E,
  45. Eigen::VectorXi & EMAP,
  46. Eigen::MatrixXi & EF,
  47. Eigen::MatrixXi & EI);
  48. }
  49. #ifndef IGL_STATIC_LIBRARY
  50. # include "edge_flaps.cpp"
  51. #endif
  52. #endif