extract_cells_single_component.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Qingnan Zhou <[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. //
  9. #ifndef IGL_COPYLEFT_CGAL_EXTRACT_CELLS_SINGLE_COMPONENT_H
  10. #define IGL_COPYLEFT_CGAL_EXTRACT_CELLS_SINGLE_COMPONENT_H
  11. #include "../../igl_inline.h"
  12. #include <Eigen/Core>
  13. #include <vector>
  14. namespace igl {
  15. namespace copyleft
  16. {
  17. namespace cgal
  18. {
  19. /// Extract connected 3D space partitioned by mesh (V,F) composed of
  20. /// **possibly multiple components** (the name of this function is
  21. /// dubious).
  22. ///
  23. /// @param[in] V #V by 3 array of vertices.
  24. /// @param[in] F #F by 3 array of faces.
  25. /// @param[in] P #F list of patch indices.
  26. /// @param[in] E #E by 2 array of vertex indices, one edge per row.
  27. /// @param[in] uE #uE by 2 list of vertex_indices, represents undirected edges.
  28. /// @param[in] EMAP #F*3 list of indices into uE.
  29. /// @param[in] uEC #uE+1 list of cumsums of directed edges sharing each unique edge
  30. /// @param[in] uEE #E list of indices into E (see `igl::unique_edge_map`)
  31. /// @param[out] cells #P by 2 array of cell indices. cells(i,0) represents the
  32. /// cell index on the positive side of patch i, and cells(i,1)
  33. /// represents cell index of the negative side.
  34. /// @return number of components
  35. template<
  36. typename DerivedV,
  37. typename DerivedF,
  38. typename DerivedP,
  39. typename DeriveduE,
  40. typename DerivedEMAP,
  41. typename DeriveduEC,
  42. typename DeriveduEE,
  43. typename DerivedC >
  44. IGL_INLINE size_t extract_cells_single_component(
  45. const Eigen::PlainObjectBase<DerivedV>& V,
  46. const Eigen::PlainObjectBase<DerivedF>& F,
  47. const Eigen::PlainObjectBase<DerivedP>& P,
  48. const Eigen::PlainObjectBase<DeriveduE>& uE,
  49. const Eigen::PlainObjectBase<DerivedEMAP>& EMAP,
  50. const Eigen::PlainObjectBase<DeriveduEC>& uEC,
  51. const Eigen::PlainObjectBase<DeriveduEE>& uEE,
  52. Eigen::PlainObjectBase<DerivedC>& cells);
  53. }
  54. }
  55. }
  56. #ifndef IGL_STATIC_LIBRARY
  57. # include "extract_cells_single_component.cpp"
  58. #endif
  59. #endif