added ClusterVertex (like MergeCloseVertex but without removing the copies)

This commit is contained in:
ganovelli 2010-09-23 16:47:25 +00:00
parent af5e0eb46b
commit 09c8ff302a
1 changed files with 11 additions and 4 deletions

View File

@ -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<VertexType, ScalarType> 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<int,int> RemoveSmallConnectedComponentsSize(MeshType &m, int maxCCSize)
{
std::vector< std::pair<int, typename MeshType::FacePointer> > CCV;