extract_manifold_patches.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_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. // Inputs:
  19. // F #F by 3 list representing triangles.
  20. // EMAP #F*3 list of indices of unique undirected edges.
  21. // uE2E #uE list of lists of indices into E of coexisting edges.
  22. //
  23. // Output:
  24. // P #F list of patch incides.
  25. //
  26. // Returns:
  27. // number of manifold patches.
  28. template <
  29. typename DerivedF,
  30. typename DerivedEMAP,
  31. typename uE2EType,
  32. typename DerivedP>
  33. IGL_INLINE size_t extract_manifold_patches(
  34. const Eigen::PlainObjectBase<DerivedF>& F,
  35. const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
  36. const std::vector<std::vector<uE2EType> >& uE2E,
  37. Eigen::PlainObjectBase<DerivedP>& P);
  38. template <
  39. typename DerivedF,
  40. typename DerivedP>
  41. IGL_INLINE size_t extract_manifold_patches(
  42. const Eigen::PlainObjectBase<DerivedF>& F,
  43. Eigen::PlainObjectBase<DerivedP>& P);
  44. }
  45. #ifndef IGL_STATIC_LIBRARY
  46. # include "extract_manifold_patches.cpp"
  47. #endif
  48. #endif