extract_manifold_patches.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_EXTRACT_MANIFOLD_PATCHES
  9. #define IGL_EXTRACT_MANIFOLD_PATCHES
  10. #include "igl_inline.h"
  11. #include <Eigen/Dense>
  12. #include <vector>
  13. namespace igl {
  14. /// Extract a set of maximal patches from a given mesh.
  15. /// A maximal patch is a subset of the input faces that are connected via
  16. /// manifold edges; a patch is as large as possible.
  17. ///
  18. /// @param[in] F #F by 3 list representing triangles.
  19. /// @param[in] EMAP #F*3 list of indices of unique undirected edges.
  20. /// @param[in] uEC #uE+1 list of cumsums of directed edges sharing each unique edge
  21. /// @param[in] uEE #F*3 list of indices into E (see `igl::unique_edge_map`)
  22. /// @param[out] P #F list of patch incides.
  23. /// @return number of manifold patches.
  24. template <
  25. typename DerivedF,
  26. typename DerivedEMAP,
  27. typename DeriveduEC,
  28. typename DeriveduEE,
  29. typename DerivedP>
  30. IGL_INLINE int extract_manifold_patches(
  31. const Eigen::MatrixBase<DerivedF>& F,
  32. const Eigen::MatrixBase<DerivedEMAP>& EMAP,
  33. const Eigen::MatrixBase<DeriveduEC>& uEC,
  34. const Eigen::MatrixBase<DeriveduEE>& uEE,
  35. Eigen::PlainObjectBase<DerivedP>& P);
  36. /// \overload
  37. /// @param[in] uE2E #uE list of lists of indices into E of coexisting edges.
  38. template <
  39. typename DerivedF,
  40. typename DerivedEMAP,
  41. typename uE2EType,
  42. typename DerivedP>
  43. IGL_INLINE int extract_manifold_patches(
  44. const Eigen::MatrixBase<DerivedF>& F,
  45. const Eigen::MatrixBase<DerivedEMAP>& EMAP,
  46. const std::vector<std::vector<uE2EType> >& uE2E,
  47. Eigen::PlainObjectBase<DerivedP>& P);
  48. /// \overload
  49. template <
  50. typename DerivedF,
  51. typename DerivedP>
  52. IGL_INLINE int extract_manifold_patches(
  53. const Eigen::MatrixBase<DerivedF> &F,
  54. Eigen::PlainObjectBase<DerivedP> &P);
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "extract_manifold_patches.cpp"
  58. #endif
  59. #endif