solstice-solver

Solver library of the solstice app
git clone git://git.meso-star.com/solstice-solver.git
Log | Files | Refs | README | LICENSE

commit daf7e6f57a69994ff5deab3965d4d848e096d6f0
parent 474abaa66b5f4a72147ca29078d17c1e8b4a1ae0
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri,  1 Sep 2017 09:08:53 +0200

Fix the upd of path position when it restarts from a virtual surface

When a ray hits a surface with a virtual material, some treatments are
performed and it pursues its trip from the intersection point. In order
to avoid numerical inaccuracy, the origin of the new "departure" is not
move to the hit position. Instead, the minimum boundary of the original
ray is set just after the previous hit distance and the new ray is
traced with the same origin.

This algorithmic trick was not correctly handled in the update of the
radiative path position. This commit fixes this issue.

Diffstat:
Msrc/ssol_solver.c | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/ssol_solver.c b/src/ssol_solver.c @@ -353,7 +353,9 @@ point_update_from_hit case SHAPE_PUNCHED: d3_normalize(pt->N, rdata->N); d3_muld(tmp, pt->dir, rdata->dst); - d3_add(pt->pos, pt->pos, tmp); + f3_set_d3(tmpf, tmp); + f3_add(tmpf, org, tmpf); + d3_set_f3(pt->pos, tmpf); break; default: FATAL("Unreachable code"); break; }