added ClusterVertex (like MergeCloseVertex but without removing the copies)
This commit is contained in:
parent
af5e0eb46b
commit
09c8ff302a
|
@ -1357,6 +1357,14 @@ private:
|
||||||
This function merge all the vertices that are closer than the given radius
|
This function merge all the vertices that are closer than the given radius
|
||||||
*/
|
*/
|
||||||
static int MergeCloseVertex(MeshType &m, const ScalarType 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;
|
typedef vcg::SpatialHashTable<VertexType, ScalarType> SampleSHT;
|
||||||
SampleSHT sht;
|
SampleSHT sht;
|
||||||
|
@ -1380,14 +1388,13 @@ static int MergeCloseVertex(MeshType &m, const ScalarType radius)
|
||||||
float dist = Distance(p,closests[i]->cP());
|
float dist = Distance(p,closests[i]->cP());
|
||||||
if(dist < radius && !closests[i]->IsV())
|
if(dist < radius && !closests[i]->IsV())
|
||||||
{
|
{
|
||||||
|
printf("%f %f \n",dist,radius);
|
||||||
mergedCnt++;
|
mergedCnt++;
|
||||||
closests[i]->SetV();
|
closests[i]->SetV();
|
||||||
closests[i]->P()=p;
|
closests[i]->P()=p;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RemoveDuplicateVertex(m,true);
|
|
||||||
return mergedCnt;
|
return mergedCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue