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 e1dfe73adfddff184e5f52569c562f83948863e4
parent 1a61b5d67cba0b619af92759a559e605afd893fc
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 29 Sep 2022 16:05:28 +0200

Fix discrete phase function sampling

Diffstat:
Msrc/ssf_phase_discrete.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ssf_phase_discrete.c b/src/ssf_phase_discrete.c @@ -242,8 +242,8 @@ discrete_eval(void* phase, const double wo[3], const double wi[3]) (&cos_theta, items, nitems, sizeof(*items), cmp_discrete_item); iitem = (size_t)(found_item - items); ASSERT(found_item && iitem > 0 && iitem < nitems); - ASSERT(cos_theta <= items[iitem-1].cos_theta); - ASSERT(cos_theta > items[iitem].cos_theta); + ASSERT(cos_theta < items[iitem-1].cos_theta); + ASSERT(cos_theta >= items[iitem].cos_theta); /* Linearly interpolate the phase function value */ u = @@ -275,7 +275,7 @@ discrete_sample size_t i = 0; double r = 0; ASSERT(phase && rng && wo && wi); - ASSERT(d3_is_normalized(wo) && d3_is_normalized(wi)); + ASSERT(d3_is_normalized(wo)); items = darray_discrete_item_cdata_get(&discrete->items); cumul = darray_double_cdata_get(&discrete->cumulative); @@ -316,7 +316,7 @@ discrete_sample /* Calculate the Cartesian coordinates of the direction in the local * coordinate system of the phase function */ wi[0] = cos(phi) * sin_theta; - wi[1] = sin(phi) * cos_theta; + wi[1] = sin(phi) * sin_theta; wi[2] = cos_theta; /* Calculate the transformation matrix from the local coordinate system of