// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2020 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "facet_adjacency_matrix.h" #include "unique_edge_map.h" template IGL_INLINE void igl::facet_adjacency_matrix( const Eigen::MatrixBase & F, Eigen::SparseMatrix & A) { using namespace Eigen; typedef typename DerivedF::Scalar Index; const auto m = F.rows(); Eigen::Matrix EMAP,uEE,uEC; Eigen::Matrix E,uE; igl::unique_edge_map(F,E,uE,EMAP,uEC,uEE); std::vector > AIJV; AIJV.reserve(2*uE.rows()); const Eigen::Index nu = uE.rows(); for(Eigen::Index ue = 0;ue0 A.resize(m,m); A.setFromTriplets(AIJV.begin(),AIJV.end()); // Set all non-zerro values to 1 for(Eigen::Index g = 0;g::InnerIterator it (A,g); it; ++it) { if(it.value()) it.valueRef() = 1; } } } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::facet_adjacency_matrix, bool>(Eigen::MatrixBase > const&, Eigen::SparseMatrix&); // generated by autoexplicit.sh template void igl::facet_adjacency_matrix, int>(Eigen::MatrixBase > const&, Eigen::SparseMatrix&); #endif