Added parameter invertQuality to PoissonDiskSampling in order to invert
how quality influences density distribution
This commit is contained in:
parent
499822bc17
commit
cf028b728b
|
@ -754,9 +754,11 @@ struct PoissonDiskParam
|
||||||
adaptiveRadiusFlag = false;
|
adaptiveRadiusFlag = false;
|
||||||
radiusVariance =1;
|
radiusVariance =1;
|
||||||
MAXLEVELS = 5;
|
MAXLEVELS = 5;
|
||||||
|
invertQuality = false;
|
||||||
}
|
}
|
||||||
bool adaptiveRadiusFlag;
|
bool adaptiveRadiusFlag;
|
||||||
float radiusVariance;
|
float radiusVariance;
|
||||||
|
bool invertQuality;
|
||||||
int MAXLEVELS;
|
int MAXLEVELS;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -774,7 +776,7 @@ static int ComputePoissonSampleNum(MetroMesh &origMesh, ScalarType diskRadius)
|
||||||
return sampleNum;
|
return sampleNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ComputePoissonSampleRadii(MetroMesh &sampleMesh, ScalarType diskRadius, ScalarType radiusVariance)
|
static void ComputePoissonSampleRadii(MetroMesh &sampleMesh, ScalarType diskRadius, ScalarType radiusVariance, bool invert)
|
||||||
{
|
{
|
||||||
VertexIterator vi;
|
VertexIterator vi;
|
||||||
std::pair<float,float> minmax = tri::Stat<MetroMesh>::ComputePerVertexQualityMinMax( sampleMesh);
|
std::pair<float,float> minmax = tri::Stat<MetroMesh>::ComputePerVertexQualityMinMax( sampleMesh);
|
||||||
|
@ -784,7 +786,7 @@ static void ComputePoissonSampleRadii(MetroMesh &sampleMesh, ScalarType diskRadi
|
||||||
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++)
|
||||||
{
|
{
|
||||||
(*vi).Q() = minRad + deltaRad*(((*vi).Q() - minmax.first)/deltaQ);
|
(*vi).Q() = minRad + deltaRad*((invert ? minmax.second - (*vi).Q() : (*vi).Q() - minmax.first )/deltaQ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,7 +875,7 @@ static void Poissondisk(MetroMesh &origMesh, VertexSampler &ps, MetroMesh &monte
|
||||||
|
|
||||||
// if we are doing variable density sampling we have to prepare the random samples quality with the correct expected radii.
|
// if we are doing variable density sampling we have to prepare the random samples quality with the correct expected radii.
|
||||||
if(pp.adaptiveRadiusFlag)
|
if(pp.adaptiveRadiusFlag)
|
||||||
ComputePoissonSampleRadii(montecarloMesh, diskRadius, pp.radiusVariance);
|
ComputePoissonSampleRadii(montecarloMesh, diskRadius, pp.radiusVariance, pp.invertQuality);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue