From 46b3024de62b3df5346ae410f17acdc34acafb69 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Thu, 27 Nov 2008 15:05:36 +0000 Subject: [PATCH] Changed as to include new Random methods --- vcg/math/spherical_harmonics.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vcg/math/spherical_harmonics.h b/vcg/math/spherical_harmonics.h index 08ede9a9..886616f3 100644 --- a/vcg/math/spherical_harmonics.h +++ b/vcg/math/spherical_harmonics.h @@ -101,6 +101,8 @@ public : RandomGenerator rand; SphericalHarmonics sph; + rand.initializeImprovedMarsenneTwister(); + int i = 0; for (unsigned k = 0; k < n_coeff; k++ ) sph.coefficients[k] = 0; @@ -109,8 +111,8 @@ public : { for (unsigned b = 0; b < sqrt_n_samples; ++b) { - ScalarType x = (a + rand(INT_MAX)/(ScalarType)INT_MAX) * one_over_n; - ScalarType y = (b + rand(INT_MAX)/(ScalarType)INT_MAX) * one_over_n; + ScalarType x = (a + ScalarType(rand.generateDoubleWithImprovedMT())) * one_over_n; + ScalarType y = (b + ScalarType(rand.generateDoubleWithImprovedMT())) * one_over_n; ScalarType theta = 2.0 * Acos(Sqrt(1.0 - x)); ScalarType phi = 2.0 * M_PI * y;