// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2014 Daniele Panozzo // // 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 "vertex_triangle_adjacency.h" #include "cumsum.h" template IGL_INLINE void igl::vertex_triangle_adjacency( const typename DerivedF::Scalar n, const Eigen::MatrixBase& F, std::vector >& VF, std::vector >& VFi) { VF.clear(); VFi.clear(); VF.resize(n); VFi.resize(n); typedef typename DerivedF::Index Index; for(Index fi=0; fi IGL_INLINE void igl::vertex_triangle_adjacency( const Eigen::MatrixBase& V, const Eigen::MatrixBase& F, std::vector >& VF, std::vector >& VFi) { return vertex_triangle_adjacency(V.rows(),F,VF,VFi); } template < typename DerivedF, typename DerivedVF, typename DerivedNI> IGL_INLINE void igl::vertex_triangle_adjacency( const Eigen::MatrixBase & F, const int n, Eigen::PlainObjectBase & VF, Eigen::PlainObjectBase & NI) { typedef Eigen::Matrix VectorXI; // vfd #V list so that vfd(i) contains the vertex-face degree (number of // faces incident on vertex i) VectorXI vfd = VectorXI::Zero(n); for (int i = 0; i < F.rows(); i++) { for (int j = 0; j < 3; j++) { vfd[F(i,j)]++; } } igl::cumsum(vfd,1,NI); // Prepend a zero NI = (DerivedNI(n+1)<<0,NI).finished(); // vfd now acts as a counter vfd = NI; VF.derived()= Eigen::VectorXi(3*F.rows()); for (int i = 0; i < F.rows(); i++) { for (int j = 0; j < 3; j++) { VF[vfd[F(i,j)]] = i; vfd[F(i,j)]++; } } } #ifdef IGL_STATIC_LIBRARY // Explicit template instantiation // generated by autoexplicit.sh template void igl::vertex_triangle_adjacency, unsigned long, unsigned long>(Eigen::Matrix::Scalar, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); // generated by autoexplicit.sh template void igl::vertex_triangle_adjacency, Eigen::Matrix, int>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, Eigen::Matrix, unsigned int>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, Eigen::Matrix, int>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, long, long>(Eigen::Matrix::Scalar, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, long, long>(Eigen::Matrix::Scalar, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, unsigned long, unsigned long>(Eigen::Matrix::Scalar, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, Eigen::Matrix, int>(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); template void igl::vertex_triangle_adjacency, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::vertex_triangle_adjacency, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, int, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); template void igl::vertex_triangle_adjacency, int, int>(Eigen::Matrix::Scalar, Eigen::MatrixBase > const&, std::vector >, std::allocator > > >&, std::vector >, std::allocator > > >&); #ifdef WIN32 template void igl::vertex_triangle_adjacency, unsigned __int64, unsigned __int64>(int, class Eigen::MatrixBase> const &, class std::vector>, class std::allocator>>> &, class std::vector>, class std::allocator>>> &); template void igl::vertex_triangle_adjacency, unsigned __int64, unsigned __int64>(int, class Eigen::MatrixBase> const &, class std::vector>, class std::allocator>>> &, class std::vector>, class std::allocator>>> &); template void igl::vertex_triangle_adjacency,__int64,__int64>(int,class Eigen::MatrixBase > const &,class std::vector >,class std::allocator > > > &,class std::vector >,class std::allocator > > > &); #endif #endif