facet_components.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 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 FACET_COMPONENTS_H
  9. #define FACET_COMPONENTS_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <vector>
  13. namespace igl
  14. {
  15. /// Compute connected components of facets based on edge-edge adjacency.
  16. ///
  17. /// For connected components on vertices see igl::vertex_components
  18. ///
  19. /// @param[in] F #F by 3 list of triangle indices
  20. /// @param[out] C #F list of connected component ids
  21. /// @return number of connected components
  22. template <typename DerivedF, typename DerivedC>
  23. IGL_INLINE int facet_components(
  24. const Eigen::MatrixBase<DerivedF> & F,
  25. Eigen::PlainObjectBase<DerivedC> & C);
  26. /// \overload
  27. ///
  28. /// @param[in] TT #TT by 3 list of list of adjacency triangles (see
  29. /// triangle_triangle_adjacency.h)
  30. /// @param[out] counts #C list of number of facets in each components
  31. template <
  32. typename TTIndex,
  33. typename DerivedC,
  34. typename Derivedcounts>
  35. IGL_INLINE void facet_components(
  36. const std::vector<std::vector<std::vector<TTIndex > > > & TT,
  37. Eigen::PlainObjectBase<DerivedC> & C,
  38. Eigen::PlainObjectBase<Derivedcounts> & counts);
  39. }
  40. #ifndef IGL_STATIC_LIBRARY
  41. # include "facet_components.cpp"
  42. #endif
  43. #endif