stardis-solver

Solve coupled heat transfers
git clone git://git.meso-star.fr/stardis-solver.git
Log | Files | Refs | README | LICENSE

commit 24f006e6444cf5e2564315e4b5f45cc23133a303
parent 4b84acae4d56cc1f21a2efcfba13ab3b81dd294e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Fri, 12 Jan 2024 10:34:56 +0100

3D ray tracing filter function updated

Self-intersections are eliminated by checking that the triangle
intersected is not the one from which the ray starts and, when the
intersection distance is below a given threshold, that the intersection
does not occur at approximately the same position but on the other side
of an edge. To check this last point, we have verified that the
triangles sharing the edge are not too small or that the distance
between the position and the edge is not too close relative to the size
of the triangles.

In this commit, we've added a new test that checks that the distance
between position and edge is not too close relative to an _absolute_
value. This is another test used to detect situations in which
calculations are performed in an area of numerical uncertainty in which
it is reasonable to assume that a self-intersection has occurred.

Diffstat:
Msrc/sdis_scene_Xd.h | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/sdis_scene_Xd.h b/src/sdis_scene_Xd.h @@ -354,6 +354,7 @@ hit_shared_edge int edge_ivertex = 0; /* Temporary variable */ int tri0_ivertex, tri1_ivertex; int iv0, iv1, iv2; + int hit_edge; ASSERT(tri0 && tri1 && pos0 && pos1); /* Fetch the vertices of the triangle 0 */ @@ -432,8 +433,15 @@ hit_shared_edge f3_sub(E1, tri1_vertices[tri1_edge[1]].value, pos1); tmp1_2area = f3_len(f3_cross(N1, E0, E1)); - return (eq_epsf(tri0_2area, 0, 1.e-6f) || tmp0_2area/tri0_2area < ON_EDGE_EPSILON) - && (eq_epsf(tri1_2area, 0, 1.e-6f) || tmp1_2area/tri1_2area < ON_EDGE_EPSILON); + hit_edge = + ( eq_epsf(tri0_2area, 0, 1.e-6f) + || eq_epsf(tmp0_2area, 0, 1.e-6f) + || tmp0_2area/tri0_2area < ON_EDGE_EPSILON); + hit_edge = hit_edge && + ( eq_epsf(tri1_2area, 0, 1.e-6f) + || eq_epsf(tmp1_2area, 0, 1.e-6f) + || tmp1_2area/tri1_2area < ON_EDGE_EPSILON); + return hit_edge; } #undef ON_EDGE_EPSILON #endif /* DIM == 2 */