Skip to content

Commit

Permalink
stop rays when exiting model
Browse files Browse the repository at this point in the history
  • Loading branch information
gridley committed Dec 20, 2023
1 parent 4adabf0 commit f58d45e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1659,6 +1659,13 @@ void Ray::trace()
if (stop_)
return;

// There are no more intersections to process
// if we hit the edge of the model, so stop
// the particle in that case:
if (dist_.distance == INFTY || dist_.distance == INFINITY) {
return;
}

// Advance particle, prepare for next intersection
for (int lev = 0; lev < n_coord(); ++lev) {
coord(lev).r += dist_.distance * coord(lev).u;
Expand Down

0 comments on commit f58d45e

Please sign in to comment.