]> OCCT Git - occt.git/commitdiff
0031881: Coding Rules - OpenGl_HaltonSampler::initRandom() uses deprecated in C+...
authorkgv <kgv@opencascade.com>
Tue, 27 Oct 2020 04:57:36 +0000 (07:57 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 28 Oct 2020 16:24:00 +0000 (19:24 +0300)
Unused function has been removed.

src/OpenGl/OpenGl_HaltonSampler.hxx
src/OpenGl/OpenGl_TileSampler.cxx

index 07758430cdd73b160edc9e762b7c178c951d9bc8..115d567e4db4ffaa754ea9ab913e2650422be5a5 100644 (file)
@@ -24,7 +24,7 @@
 #include <algorithm>
 #include <vector>
 
-//! 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 <typename Random_number_generator>
-  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<unsigned short>& thePerm)
   {
@@ -159,30 +156,4 @@ inline void OpenGl_HaltonSampler::initFaure()
   initTables (aPerms);
 }
 
-template <typename Random_number_generator>
-void OpenGl_HaltonSampler::initRandom (Random_number_generator& theRand)
-{
-  const unsigned THE_MAX_BASE = 5u;
-  std::vector<std::vector<unsigned short> > 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
index 3341c1f1506b24efbaa0517b8e862fffd5e0890c..5ac016a56f72a1cff900b531106ac954263c5794 100644 (file)
@@ -31,7 +31,7 @@ OpenGl_TileSampler::OpenGl_TileSampler()
   myTileSize   (0),
   myViewSize   (0, 0)
 {
-  mySampler.initFaure();
+  //
 }
 
 //=======================================================================