#include "components.h" #include #include #include #include #include #include template IGL_INLINE void igl::components( const Eigen::SparseMatrix & A, Eigen::PlainObjectBase & C) { assert(A.rows() == A.cols()); using namespace Eigen; boost::adjacency_matrix bA(A.rows()); for(int j=0; j::InnerIterator it (A,j); it; ++it) { if(0 != it.value()) { boost::add_edge(it.row(),it.col(),bA); } } } C.resize(A.rows(),1); boost::connected_components(bA,C.data()); } template IGL_INLINE void igl::components( const Eigen::PlainObjectBase & F, Eigen::PlainObjectBase & C) { Eigen::SparseMatrix A; igl::adjacency_matrix(F,A); return components(A,C); } #ifndef IGL_HEADER_ONLY // Explicit template specialization template void igl::components, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&); #endif