htrdr

Solving radiative transfer in heterogeneous media
git clone git://git.meso-star.fr/htrdr.git
Log | Files | Refs | README | LICENSE

commit 301c5ada70b4dc3ae4b9babd0d1e5f9d77b9de2b
parent 1992f0f4bbd6bdd81f6428bfbb075812b134b16e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Mon, 23 Nov 2020 09:32:06 +0100

Merge branch 'release_0.6.1'

Diffstat:
MREADME.md | 5+++++
Mcmake/CMakeLists.txt | 2+-
Msrc/htrdr_compute_radiance_sw.c | 13++++++++-----
Msrc/htrdr_sensor.c | 2+-
4 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md @@ -59,6 +59,11 @@ informations on CMake. ## Release notes +### Version 0.6.1 + +- Fix the self-intersection issue in shortwave computations introduced by + the 0.6 version. + ### Version 0.6 #### New features diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -60,7 +60,7 @@ include_directories( ################################################################################ set(VERSION_MAJOR 0) set(VERSION_MINOR 6) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) set(HTRDR_ARGS_DEFAULT_CAMERA_POS "0,0,0") diff --git a/src/htrdr_compute_radiance_sw.c b/src/htrdr_compute_radiance_sw.c @@ -308,9 +308,9 @@ htrdr_compute_radiance_sw d3_set(pos, pos_in); d3_set(dir, dir_in); - if((cpnt_mask & HTRDR_RADIANCE_DIRECT) /* Handle direct contribuation */ + if((cpnt_mask & HTRDR_RADIANCE_DIRECT) /* Handle direct contribation */ && htrdr_sun_is_dir_in_solar_cone(htrdr->sun, dir)) { - /* Check that the ray is not occlude along the submitted range */ + /* Check that the ray is not occluded along the submitted range */ d2(range, 0, FLT_MAX); HTRDR(ground_trace_ray(htrdr->ground, pos, dir, range, NULL, &s3d_hit_tmp)); if(!S3D_HIT_NONE(&s3d_hit_tmp)) { @@ -366,11 +366,17 @@ htrdr_compute_radiance_sw /* Negate the incoming dir to match the convention of the SSF library */ d3_minus(wo, dir); + /* Define if the scattering occurs at a surface */ + surface_scattering = SVX_HIT_NONE(&svx_hit); + /* Compute the new position */ pos_next[0] = pos[0] + dir[0]*scattering_ctx.traversal_dst; pos_next[1] = pos[1] + dir[1]*scattering_ctx.traversal_dst; pos_next[2] = pos[2] + dir[2]*scattering_ctx.traversal_dst; + /* Define the previous hit surface used to avoid self hit */ + s3d_hit_prev = surface_scattering ? s3d_hit : S3D_HIT_NULL; + /* Define the absorption transmissivity from the current position to the * next position */ d2(range, 0, scattering_ctx.traversal_dst); @@ -378,8 +384,6 @@ htrdr_compute_radiance_sw (htrdr, rng, HTSKY_Ka, iband, iquad, pos, dir, range); if(Tr_abs <= 0) break; - surface_scattering = SVX_HIT_NONE(&svx_hit); - /* Sample the scattering direction */ if(surface_scattering) { /* Scattering at a surface */ struct htrdr_interface interf = HTRDR_INTERFACE_NULL; @@ -453,7 +457,6 @@ htrdr_compute_radiance_sw } else { /* Check that the sun is visible from the new position */ d2(range, 0, FLT_MAX); - s3d_hit_prev = SVX_HIT_NONE(&svx_hit) ? s3d_hit : S3D_HIT_NULL; HTRDR(ground_trace_ray (htrdr->ground, pos_next, sun_dir, range, &s3d_hit_prev, &s3d_hit_tmp)); diff --git a/src/htrdr_sensor.c b/src/htrdr_sensor.c @@ -63,7 +63,7 @@ sample_rectangle_ray struct s3d_hit hit = S3D_HIT_NULL; double pix_samp[2]; const double up_dir[3] = {0,0,1}; - const double range[2] = {0, INF}; + const double range[2] = {0, DBL_MAX}; double normal[3]; ASSERT(rect && htrdr && ipix && pix_sz && rng && ray_org && ray_dir);