From a9a17a07132f477594440e7abb73a5b9f4011aa9 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Mon, 15 Dec 2008 08:49:02 +0000 Subject: [PATCH] Aligned with current implementation of RandomGenerator --- vcg/math/spherical_harmonics.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/vcg/math/spherical_harmonics.h b/vcg/math/spherical_harmonics.h index 886616f3..e7e30f02 100644 --- a/vcg/math/spherical_harmonics.h +++ b/vcg/math/spherical_harmonics.h @@ -98,11 +98,9 @@ public : ScalarType one_over_n = 1.0/(ScalarType)sqrt_n_samples; - RandomGenerator rand; + MarsenneTwisterRNG rand; SphericalHarmonics sph; - rand.initializeImprovedMarsenneTwister(); - int i = 0; for (unsigned k = 0; k < n_coeff; k++ ) sph.coefficients[k] = 0; @@ -111,8 +109,8 @@ public : { for (unsigned b = 0; b < sqrt_n_samples; ++b) { - ScalarType x = (a + ScalarType(rand.generateDoubleWithImprovedMT())) * one_over_n; - ScalarType y = (b + ScalarType(rand.generateDoubleWithImprovedMT())) * one_over_n; + ScalarType x = (a + ScalarType(rand.generate01())) * one_over_n; + ScalarType y = (b + ScalarType(rand.generate01())) * one_over_n; ScalarType theta = 2.0 * Acos(Sqrt(1.0 - x)); ScalarType phi = 2.0 * M_PI * y;