commit 49b65ae891d13f267652a2b14d6037abe4ee36f6
parent 5d1344b82cd16e708a559b408ab1f893282959cd
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 17 Apr 2025 18:37:34 +0200
Fix radiative paths that do not start at the boundary
The way to deal with numerical problems assumed that the position of the
ray started from a primitive. This is not always the case, for example
when rendering an image.
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/sdis_heat_path_radiative_Xd.h b/src/sdis_heat_path_radiative_Xd.h
@@ -391,8 +391,8 @@ XD(find_next_fragment)
struct sdis_interface** out_interf,
struct sdis_interface_fragment* out_frag)
{
- const int NATTEMPTS_MAX = 10;
- int nattempts = 0;
+ int NATTEMPTS_MAX = 10;
+ int nattempts = 1;
/* Stardis */
struct sdis_interface_fragment frag = SDIS_INTERFACE_FRAGMENT_NULL;
@@ -405,6 +405,9 @@ XD(find_next_fragment)
ASSERT(scn && in_pos && in_dir && in_hit);
ASSERT(out_hit && out_interf && out_frag);
+ /* Only one attempt is allowed when the ray does not start from a primitive */
+ NATTEMPTS_MAX = S3D_HIT_NONE(in_hit) ? 1 : 10;
+
dX(set)(rt_pos, in_pos);
do {