// 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 "polygon_corners.h" template < typename PType, typename DerivedI, typename DerivedC> IGL_INLINE void igl::polygon_corners( const std::vector > & P, Eigen::PlainObjectBase & I, Eigen::PlainObjectBase & C) { typedef typename DerivedI::Scalar IType; // JD: Honestly you could do a first loop over P, compute C, and then fill the // entries of I directly. No need for guesses and push_back(), or the extra // copy at the end. That would be more efficient. std::vector vI;vI.reserve(P.size()*4); C.resize(P.size()+1); C(0) = 0; for(size_t p = 0;p(vI.data(),vI.size()); } template < typename DerivedQ, typename DerivedI, typename DerivedC> IGL_INLINE void igl::polygon_corners( const Eigen::MatrixBase & Q, Eigen::PlainObjectBase & I, Eigen::PlainObjectBase & C) { I.resize(Q.size()); C.resize(Q.rows()+1); Eigen::Index c = 0; C(0) = 0; for(Eigen::Index p = 0;p, Eigen::Matrix, Eigen::Matrix >(Eigen::MatrixBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); // generated by autoexplicit.sh template void igl::polygon_corners, Eigen::Matrix >(std::vector >, std::allocator > > > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif