We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f796fa0 commit 1a7e5c8Copy full SHA for 1a7e5c8
1 file changed
src/mesh.cpp
@@ -989,15 +989,17 @@ void StructuredMesh::raytrace_mesh(
989
// For all directions outside the mesh, find the distance that we need
990
// to travel to reach the next surface. Use the largest distance, as
991
// only this will cross all outer surfaces.
992
- int k_max {0};
+ int k_max {-1};
993
for (int k = 0; k < n; ++k) {
994
if ((ijk[k] < 1 || ijk[k] > shape_[k]) &&
995
(distances[k].distance > traveled_distance)) {
996
traveled_distance = distances[k].distance;
997
k_max = k;
998
}
999
1000
-
+ // Assure some distance is traveled
1001
+ if (k_max == -1)
1002
+ traveled_distance += TINY_BIT;
1003
// If r1 is not inside the mesh, exit here
1004
if (traveled_distance >= total_distance)
1005
return;
0 commit comments