commit e1c28a16a41e7d09442c5a650b7aeb051fa68ea8
parent fe13c10fea3a62f47fce9f023efaea9ee68a015a
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 9 Dec 2015 09:38:42 +0100
Fix an issue in the sampling of the primitive
The random variables used to sample a Star-3D primitive must be canonic.
The ssp_ran_canonical ensure this property for double precision floating
point numbers but single precision is actually used. A mecanism was
implemented to ensure that the "double to float" conversion still
produced canonical random variables but it was bugged. This commit fixes
this issue.
Note that a "ssp_ran_canonical_float" routine in the Star-SP library
will avoid this issue wihtout any specific treatment. Todo !
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sgf_estimator.c b/src/sgf_estimator.c
@@ -130,7 +130,7 @@ gebhart_radiative_path
/* Uniformly sample the primitive to define the starting position of the
* radiative path */
do { u = (float)ssp_rng_canonical(rng); } while(u >= 1.f);
- do { v = (float)ssp_rng_canonical(rng); } while(u >= 1.f);
+ do { v = (float)ssp_rng_canonical(rng); } while(v >= 1.f);
S3D(primitive_sample(&prim, u, v, st));
S3D(primitive_get_attrib(&prim, S3D_POSITION, st, &attrib));