facet_components.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 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. // Inputs:
  18. // F #F by 3 list of triangle indices
  19. // Ouputs:
  20. // C #F list of connected component ids
  21. template <typename DerivedF, typename DerivedC>
  22. IGL_INLINE void facet_components(
  23. const Eigen::PlainObjectBase<DerivedF> & F,
  24. Eigen::PlainObjectBase<DerivedC> & C);
  25. // Inputs:
  26. // TT #TT by 3 list of list of adjacency triangles (see
  27. // triangle_triangle_adjacency.h)
  28. // Ouputs:
  29. // C #F list of connected component ids
  30. // 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