diff --git a/vcg/complex/trimesh/clean.h b/vcg/complex/trimesh/clean.h index dfcc8fb2..44766950 100644 --- a/vcg/complex/trimesh/clean.h +++ b/vcg/complex/trimesh/clean.h @@ -1357,6 +1357,14 @@ private: This function merge all the vertices that are closer than the given radius */ static int MergeCloseVertex(MeshType &m, const ScalarType radius) + { + int mergedCnt=0; + mergedCnt = ClusterVertex(m,radius); + RemoveDuplicateVertex(m,true); + return mergedCnt; + } + +static int ClusterVertex(MeshType &m, const ScalarType radius) { typedef vcg::SpatialHashTable SampleSHT; SampleSHT sht; @@ -1380,18 +1388,17 @@ static int MergeCloseVertex(MeshType &m, const ScalarType radius) float dist = Distance(p,closests[i]->cP()); if(dist < radius && !closests[i]->IsV()) { + printf("%f %f \n",dist,radius); mergedCnt++; closests[i]->SetV(); closests[i]->P()=p; } } } - - RemoveDuplicateVertex(m,true); return mergedCnt; } - - + + static std::pair RemoveSmallConnectedComponentsSize(MeshType &m, int maxCCSize) { std::vector< std::pair > CCV;