From aec8880e851a7eedc2669eb3254e52f471264d26 Mon Sep 17 00:00:00 2001 From: alemuntoni Date: Mon, 23 Aug 2021 16:24:23 +0200 Subject: [PATCH] restore deterministic poisson sampling --- vcg/complex/algorithms/point_sampling.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/vcg/complex/algorithms/point_sampling.h b/vcg/complex/algorithms/point_sampling.h index d5e711f8..1647e782 100644 --- a/vcg/complex/algorithms/point_sampling.h +++ b/vcg/complex/algorithms/point_sampling.h @@ -502,6 +502,18 @@ static unsigned int RandomInt(unsigned int i) return (SamplingRandomGenerator().generate(i)); } +class MarsenneTwisterURBG +{ +public: + typedef unsigned int result_type; + MarsenneTwisterURBG(result_type max) : _max(max) {} + result_type min() const {return 0;} + result_type max() const {return _max;} + result_type operator()() {return SamplingRandomGenerator().generate(_max);} +private: + result_type _max; +}; + // Returns a random number in the [0,1) real interval using the improved Marsenne-Twister method. static double RandomDouble01() { @@ -714,8 +726,9 @@ static void FillAndShuffleFacePointerVector(MeshType & m, std::vector &vertVec) @@ -726,8 +739,9 @@ static void FillAndShuffleVertexPointerVector(MeshType & m, std::vector