add fake poisson-disk sampling

This commit is contained in:
Massimiliano Corsini 2008-11-17 12:52:17 +00:00
parent 5c6c7cafd5
commit 99e6ea5dd6
1 changed files with 23 additions and 3 deletions

View File

@ -592,6 +592,26 @@ static void SingleFaceRaster(FaceType &f, VertexSampler &ps, const Point2<Scala
} }
} }
/// Compute a Poisson-disk sampling of the surface
/// The radius of the disk is computed according to the estimated sampling density.
static void Poissondisk(MetroMesh &m, VertexSampler &ps, int sampleNum)
{
FaceIterator fi;
// first of all computed r
ScalarType meshArea = Stat<MetroMesh>::ComputeMeshArea(m);
ScalarType r = sqrt(meshArea / (0.7 * 3.1415 * sampleNum)); // 0.7 is a density factor
for (fi = m.face.begin(); fi != m.face.end(); fi++)
{
ps.AddFace(*fi, RandomBaricentric());
}
for (int i = 0; i < sampleNum; i++)
{
//...TODO...
}
}
//template <class MetroMesh> //template <class MetroMesh>
//void Sampling<MetroMesh>::SimilarFaceSampling() //void Sampling<MetroMesh>::SimilarFaceSampling()