star-sf

Set of surface and volume scattering functions
git clone git://git.meso-star.fr/star-sf.git
Log | Files | Refs | README | LICENSE

commit d7de821f5287bd8cba8392849c5251ed27efa118
parent 46e0e9b89ecbd6afb1287ecc623dab288b5ddda4
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 19 Jul 2018 08:40:47 +0200

Test the evalfunction of the HG phase function

Diffstat:
Msrc/test_ssf_phase_hg.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/test_ssf_phase_hg.c b/src/test_ssf_phase_hg.c @@ -58,9 +58,15 @@ main(int argc, char** argv) double wi[3]; double pdf; double w; + double r; + double ref; ssf_phase_sample(phase, rng, wo, wi, &pdf); CHK(d3_is_normalized(wi)); CHK(eq_eps(ssf_phase_pdf(phase, wo, wi), pdf, 1.e-6)); + r = ssf_phase_eval(phase, wo, wi); + /* HG(theta) = 1/(4*PI) * (1 - g^2) / (1 + g^2 - 2*g*cos(theta))^3/2 */ + ref = 1/(4*PI) * (1-g*g) / pow(1+g*g-2*g*d3_dot(wi,wo), 1.5); + CHK(eq_eps(r, ref, 1.e-6)); w = d3_dot(wo, wi); sum_cos += w; sum_cos_sqr += w*w; @@ -81,3 +87,4 @@ main(int argc, char** argv) CHK(mem_allocated_size() == 0); return 0; } +