From e532407ddc4a8a2dbab5f9fd1384a771dbfe2e48 Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 18 Apr 2014 08:27:38 +0000 Subject: [PATCH] Added the possibility to control the random generator seeding in the poisson pruning wrappers --- vcg/complex/algorithms/point_sampling.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vcg/complex/algorithms/point_sampling.h b/vcg/complex/algorithms/point_sampling.h index 88c3e92a..addbed1e 100644 --- a/vcg/complex/algorithms/point_sampling.h +++ b/vcg/complex/algorithms/point_sampling.h @@ -210,6 +210,7 @@ static math::MarsenneTwisterRNG &SamplingRandomGenerator() } // Returns an integer random number in the [0,i-1] interval using the improve Marsenne-Twister method. +// this functor is needed for passing it to the std functions. static unsigned int RandomInt(unsigned int i) { return (SamplingRandomGenerator().generate(i)); @@ -1774,10 +1775,12 @@ void PoissonPruning(MeshType &m, // the mesh that has to be pruned template void PoissonPruning(MeshType &m, // the mesh that has to be pruned std::vector &poissonSamples, // the vector that will contain the chosen set of points - float & radius, int sampleNum=0) + float & radius, int sampleNum=0, unsigned int randSeed=0) { typedef tri::TrivialPointerSampler BaseSampler; typename tri::SurfaceSampling::PoissonDiskParam pp; + if(randSeed !=0) + tri::SurfaceSampling::SamplingRandomGenerator().initialize(randSeed); if(sampleNum>0 && radius==0) radius = tri::SurfaceSampling::ComputePoissonDiskRadius(m,sampleNum);