From a45445af0d78e503675dfd06cc90fa11d657ad40 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Fri, 14 Dec 2007 11:52:18 +0000 Subject: [PATCH] now use the correct deleteFace/vert and returns info on the number of deleted stuff --- .../cleanfilter/remove_small_cc.h | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/meshlabplugins/cleanfilter/remove_small_cc.h b/src/meshlabplugins/cleanfilter/remove_small_cc.h index 2828d3375..8abbd139f 100644 --- a/src/meshlabplugins/cleanfilter/remove_small_cc.h +++ b/src/meshlabplugins/cleanfilter/remove_small_cc.h @@ -24,6 +24,9 @@ History $Log$ + Revision 1.2 2007/12/14 11:52:18 cignoni + now use the correct deleteFace/vert and returns info on the number of deleted stuff + Revision 1.1 2006/11/07 09:09:28 cignoni First Working release, moved in from epoch svn @@ -40,34 +43,38 @@ namespace vcg { template -void RemoveSmallConnectedComponentsSize(MeshType &m, int maxCCSize) +std::pair RemoveSmallConnectedComponentsSize(MeshType &m, int maxCCSize) { std::vector< std::pair > CCV; - int tt=vcg::tri::Clean::ConnectedComponents(m, CCV); - + int TotalCC=vcg::tri::Clean::ConnectedComponents(m, CCV); + int DeletedCC=0; + tri::ConnectedIterator ci; for(unsigned int i=0;i FPV; if(CCV[i].first::iterator fpvi; for(fpvi=FPV.begin(); fpvi!=FPV.end(); ++fpvi) - (**fpvi).SetD(); - m.fn-=FPV.size(); + tri::Allocator::DeleteFace(m,(**fpvi)); } } + return make_pair(TotalCC,DeletedCC); } +/// Remove the connected components smaller than a given diameter +// it returns a pair with the number of connected components and the number of deleted ones. template -void RemoveSmallConnectedComponentsDiameter(MeshType &m, typename MeshType::ScalarType maxDiameter) +std::pair RemoveSmallConnectedComponentsDiameter(MeshType &m, typename MeshType::ScalarType maxDiameter) { std::vector< std::pair > CCV; - int tt=vcg::tri::Clean::ConnectedComponents(m, CCV); - + int TotalCC=vcg::tri::Clean::ConnectedComponents(m, CCV); + int DeletedCC=0; tri::ConnectedIterator ci; for(unsigned int i=0;i::iterator fpvi; for(fpvi=FPV.begin(); fpvi!=FPV.end(); ++fpvi) - (**fpvi).SetD(); - m.fn-=FPV.size(); + tri::Allocator::DeleteFace(m,(**fpvi)); } } + return make_pair(TotalCC,DeletedCC); } } //end namespace #endif