// // removeUnreferenced.h // Preview3D // // Created by Daniele Panozzo on 17/11/11. #ifndef IGL_REMOVEUNREFERENCED_H #define IGL_REMOVEUNREFERENCED_H #include namespace igl { // [ NV, NF ] = removeUnreferenced( V,F,epsilon ) // Remove unreferenced vertices from V, updating F accordingly // // Input: // V,F: mesh description // // Output: // NV, NF: new mesh without unreferenced vertices template inline void removeUnreferenced(const Eigen::Matrix &V, const Eigen::MatrixXi &F, Eigen::Matrix &NV, Eigen::MatrixXi &NF, Eigen::VectorXi &I); } // Implementation template inline void igl::removeUnreferenced(const Eigen::Matrix &V, const Eigen::MatrixXi &F, Eigen::Matrix &NV, Eigen::MatrixXi &NF, Eigen::VectorXi &I) { // Mark referenced vertices Eigen::MatrixXi mark = Eigen::MatrixXi::Zero(V.rows(),1); for(int i=0; i(newsize,V.cols()); NF = Eigen::MatrixXi(F.rows(),F.cols()); I = Eigen::MatrixXi(V.rows(),1); // Do a pass on the marked vector and remove the unreferenced vertices int count = 0; for(int i=0;i