diff --git a/src/OpenGl/OpenGl_HaltonSampler.hxx b/src/OpenGl/OpenGl_HaltonSampler.hxx index 07758430cd..115d567e4d 100644 --- a/src/OpenGl/OpenGl_HaltonSampler.hxx +++ b/src/OpenGl/OpenGl_HaltonSampler.hxx @@ -24,7 +24,7 @@ #include #include -//! Compute points of the Halton sequence with with digit-permutations for different bases. +//! Compute points of the Halton sequence with digit-permutations for different bases. class OpenGl_HaltonSampler { public: @@ -35,19 +35,13 @@ public: public: //! Init the permutation arrays using Faure-permutations. - //! Alternatively, initRandom() can be called before the sampling functionality can be used. - void initFaure(); - - //! Init the permutation arrays using randomized permutations. - //! Alternatively, initFaure() can be called before the sampling functionality can be used. - //! The client needs to specify a random number generator function object that can be used to generate a random sequence of integers. - //! That is: if f is a random number generator and N is a positive integer, - //! then f(N) will return an integer less than N and greater than or equal to 0. - template - void initRandom (Random_number_generator& theRand); + OpenGl_HaltonSampler() + { + initFaure(); + } //! Return the Halton sample for the given dimension (component) and index. - //! The client must have called initRandom or initFaure() at least once before. + //! The client must have called initFaure() at least once before. //! dimension must be smaller than the value returned by get_num_dimensions(). float sample (unsigned theDimension, unsigned theIndex) const { @@ -62,6 +56,9 @@ public: private: + //! Init the permutation arrays using Faure-permutations. + void initFaure(); + static unsigned short invert (unsigned short theBase, unsigned short theDigits, unsigned short theIndex, const std::vector& thePerm) { @@ -159,30 +156,4 @@ inline void OpenGl_HaltonSampler::initFaure() initTables (aPerms); } -template -void OpenGl_HaltonSampler::initRandom (Random_number_generator& theRand) -{ - const unsigned THE_MAX_BASE = 5u; - std::vector > aPerms(THE_MAX_BASE + 1); - for (unsigned k = 1; k <= 3; ++k) // Keep identity permutations for base 1, 2, 3. - { - aPerms[k].resize (k); - for (unsigned i = 0; i < k; ++i) - { - aPerms[k][i] = i; - } - } - - for (unsigned aBase = 4; aBase <= THE_MAX_BASE; ++aBase) - { - aPerms[aBase].resize (aBase); - for (unsigned i = 0; i < aBase; ++i) - { - aPerms[aBase][i] = i; - } - std::random_shuffle (aPerms[aBase].begin(), aPerms[aBase].end(), theRand); - } - initTables (aPerms); -} - #endif // _OpenGl_HaltonSampler_H diff --git a/src/OpenGl/OpenGl_TileSampler.cxx b/src/OpenGl/OpenGl_TileSampler.cxx index 3341c1f150..5ac016a56f 100644 --- a/src/OpenGl/OpenGl_TileSampler.cxx +++ b/src/OpenGl/OpenGl_TileSampler.cxx @@ -31,7 +31,7 @@ OpenGl_TileSampler::OpenGl_TileSampler() myTileSize (0), myViewSize (0, 0) { - mySampler.initFaure(); + // } //=======================================================================