// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2016 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 "connect_boundary_to_infinity.h" #include "boundary_facets.h" template IGL_INLINE void igl::connect_boundary_to_infinity( const Eigen::PlainObjectBase & F, Eigen::PlainObjectBase & FO) { return connect_boundary_to_infinity(F,F.maxCoeff(),FO); } template IGL_INLINE void igl::connect_boundary_to_infinity( const Eigen::PlainObjectBase & F, const typename DerivedF::Scalar inf_index, Eigen::PlainObjectBase & FO) { // Determine boundary edges Eigen::Matrix O; boundary_facets(F,O); FO.resize(F.rows()+O.rows(),F.cols()); typedef Eigen::Matrix VectorXI; FO.topLeftCorner(F.rows(),F.cols()) = F; FO.bottomLeftCorner(O.rows(),O.cols()) = O.rowwise().reverse(); FO.bottomRightCorner(O.rows(),1).setConstant(inf_index); } template < typename DerivedV, typename DerivedF, typename DerivedVO, typename DerivedFO> IGL_INLINE void igl::connect_boundary_to_infinity( const Eigen::PlainObjectBase & V, const Eigen::PlainObjectBase & F, Eigen::PlainObjectBase & VO, Eigen::PlainObjectBase & FO) { typename DerivedV::Index inf_index = V.rows(); connect_boundary_to_infinity(F,inf_index,FO); VO.resize(V.rows()+1,V.cols()); VO.topLeftCorner(V.rows(),V.cols()) = V; auto inf = std::numeric_limits::infinity(); VO.row(V.rows()).setConstant(inf); } #ifdef IGL_STATIC_LIBRARY template void igl::connect_boundary_to_infinity, Eigen::Matrix, Eigen::Matrix, Eigen::Matrix >(Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase > const&, Eigen::PlainObjectBase >&, Eigen::PlainObjectBase >&); #endif