Poisson sampling was ignoring the DELETED flag, so when a part of a mesh was deleted but still in memory, would sample it. added a couple of if(!(*vi).IsD()) tests in [InitSpatialHashTable], [ComputePoissonSampleRadii] and [PoissonDiskPruning].
Seems to work, but please test it. Beware: there could be more places where this is needed; I only checked poisson.
This commit is contained in:
parent
17ed6bdac4
commit
0ba814697c
|
@ -1328,9 +1328,10 @@ static void ComputePoissonSampleRadii(MetroMesh &sampleMesh, ScalarType diskRadi
|
||||||
float deltaQ = minmax.second-minmax.first;
|
float deltaQ = minmax.second-minmax.first;
|
||||||
float deltaRad = maxRad-minRad;
|
float deltaRad = maxRad-minRad;
|
||||||
for (vi = sampleMesh.vert.begin(); vi != sampleMesh.vert.end(); vi++)
|
for (vi = sampleMesh.vert.begin(); vi != sampleMesh.vert.end(); vi++)
|
||||||
{
|
if(!(*vi).IsD())
|
||||||
(*vi).Q() = minRad + deltaRad*((invert ? minmax.second - (*vi).Q() : (*vi).Q() - minmax.first )/deltaQ);
|
{
|
||||||
}
|
(*vi).Q() = minRad + deltaRad*((invert ? minmax.second - (*vi).Q() : (*vi).Q() - minmax.first )/deltaQ);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize spatial hash table for searching
|
// initialize spatial hash table for searching
|
||||||
|
@ -1358,7 +1359,11 @@ static void InitSpatialHashTable(MetroMesh &montecarloMesh, MontecarloSHT &monte
|
||||||
montecarloSHT.InitEmpty(bb, gridsize);
|
montecarloSHT.InitEmpty(bb, gridsize);
|
||||||
|
|
||||||
for (VertexIterator vi = montecarloMesh.vert.begin(); vi != montecarloMesh.vert.end(); vi++)
|
for (VertexIterator vi = montecarloMesh.vert.begin(); vi != montecarloMesh.vert.end(); vi++)
|
||||||
montecarloSHT.Add(&(*vi));
|
if(!(*vi).IsD())
|
||||||
|
{
|
||||||
|
montecarloSHT.Add(&(*vi));
|
||||||
|
}
|
||||||
|
|
||||||
montecarloSHT.UpdateAllocatedCells();
|
montecarloSHT.UpdateAllocatedCells();
|
||||||
if(pp.pds)
|
if(pp.pds)
|
||||||
{
|
{
|
||||||
|
@ -1397,10 +1402,11 @@ static void PoissonDiskPruning(VertexSampler &ps, MetroMesh &montecarloMesh,
|
||||||
{
|
{
|
||||||
// Initial pass for pruning the Hashed grid with the an eventual pre initialized set of samples
|
// Initial pass for pruning the Hashed grid with the an eventual pre initialized set of samples
|
||||||
for(VertexIterator vi =pp.preGenMesh->vert.begin(); vi!=pp.preGenMesh->vert.end();++vi)
|
for(VertexIterator vi =pp.preGenMesh->vert.begin(); vi!=pp.preGenMesh->vert.end();++vi)
|
||||||
{
|
if(!(*vi).IsD())
|
||||||
ps.AddVert(*vi);
|
{
|
||||||
removedCnt += montecarloSHT.RemoveInSphere(vi->cP(),diskRadius);
|
ps.AddVert(*vi);
|
||||||
}
|
removedCnt += montecarloSHT.RemoveInSphere(vi->cP(),diskRadius);
|
||||||
|
}
|
||||||
montecarloSHT.UpdateAllocatedCells();
|
montecarloSHT.UpdateAllocatedCells();
|
||||||
}
|
}
|
||||||
vertex::ApproximateGeodesicDistanceFunctor<VertexType> GDF;
|
vertex::ApproximateGeodesicDistanceFunctor<VertexType> GDF;
|
||||||
|
|
Loading…
Reference in New Issue