// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2018 Zhongshi Jiang // // 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 "topological_hole_fill.h" template < typename DerivedF, typename Derivedb, typename VectorIndex, typename DerivedF_filled> IGL_INLINE void igl::topological_hole_fill( const Eigen::MatrixBase & F, const Eigen::MatrixBase & b, const std::vector & holes, Eigen::PlainObjectBase &F_filled) { int n_filled_faces = 0; int num_holes = holes.size(); int real_F_num = F.rows(); const int V_rows = F.maxCoeff()+1; for (int i = 0; i < num_holes; i++) n_filled_faces += holes[i].size(); F_filled.resize(n_filled_faces + real_F_num, 3); F_filled.topRows(real_F_num) = F; int new_vert_id = V_rows; int new_face_id = real_F_num; for (int i = 0; i < num_holes; i++, new_vert_id++) { int cur_bnd_size = holes[i].size(); int it = 0; int back = holes[i].size() - 1; F_filled.row(new_face_id++) << holes[i][it], holes[i][back], new_vert_id; while (it != back) { F_filled.row(new_face_id++) << holes[i][(it + 1)], holes[i][(it)], new_vert_id; it++; } } assert(new_face_id == F_filled.rows()); assert(new_vert_id == V_rows + num_holes); } #ifdef IGL_STATIC_LIBRARY template void igl::topological_hole_fill, Eigen::Matrix, std::vector > >(Eigen::MatrixBase > const&, Eigen::MatrixBase > const&, std::vector >, std::allocator > > > const&, Eigen::PlainObjectBase >&); #endif