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 b9228843127a8812693c55d6d33e374205961a50
parent f99eb39978e78ecc1ba71a47fbc956120e8be079
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon,  5 Jul 2021 09:45:58 +0200

Merge branch 'release_0.7.1'

Diffstat:
MREADME.md | 5+++++
Mcmake/CMakeLists.txt | 2+-
Msrc/ssf_phase_rdgfa.c | 10+++++++---
Msrc/test_ssf_phase_rdgfa.c | 6+++---
4 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md @@ -27,6 +27,11 @@ project from the `cmake/CMakeLists.txt` file by appending to the ## Release notes +### Version 0.7.1 + +- Fix the evaluation of the RDG-FA phase function: the incident direction was + reversed. + ### Version 0.7 - Add a built-in phase function using the diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -81,7 +81,7 @@ endif() ################################################################################ set(VERSION_MAJOR 0) set(VERSION_MINOR 7) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(SSF_FILES_DOC COPYING README.md) diff --git a/src/ssf_phase_rdgfa.c b/src/ssf_phase_rdgfa.c @@ -129,7 +129,7 @@ eval2 const double cos_theta) { double f, cos2_theta, phase; - ASSERT(rdgfa && eq_eps(cos_theta, cos(theta), fabs(cos_theta*1.e-6))); + ASSERT(rdgfa && eq_eps(cos_theta, cos(theta), 1.e-6)); /* Precompute values */ cos2_theta = cos_theta * cos_theta; @@ -240,9 +240,13 @@ static double rdgfa_eval(void* data, const double wo[3], const double wi[3]) { const struct rdgfa* rdgfa = data; - const double cos_theta = d3_dot(wo, wi); - const double theta = acos(cos_theta); + double cos_theta, theta; + double v[3]; ASSERT(d3_is_normalized(wo) && d3_is_normalized(wi)); + + d3_minus(v, wo); + cos_theta = d3_dot(v, wi); + theta = acos(cos_theta); return eval2(data, theta, cos_theta) * rdgfa->rcp_normalize_factor; } diff --git a/src/test_ssf_phase_rdgfa.c b/src/test_ssf_phase_rdgfa.c @@ -68,9 +68,9 @@ main(int argc, char** argv) CHK(ssf_phase_create(&allocator, &ssf_phase_rdgfa, &phase) == RES_OK); CHK(ssf_phase_create(&allocator, &phase_dummy, &dummy) == RES_OK); - args.wavelength = 633; - args.fractal_dimension = 1.75; - args.gyration_radius = 385.17247758644652; + args.wavelength = 532; + args.fractal_dimension = 1.80; + args.gyration_radius = 111.6372805638; args.nintervals = 1000; CHK(ssf_phase_rdgfa_setup(NULL, &args) == RES_BAD_ARG); CHK(ssf_phase_rdgfa_setup(phase, NULL) == RES_BAD_ARG);