Skip to content

Commit

Permalink
Simplifies some TimeOfImpact code
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-langholtz committed Oct 12, 2023
1 parent 48c52c0 commit 8d9a2c9
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions Library/source/playrho/d2/TimeOfImpact.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,9 @@ ToiOutput GetToiViaSat( // NOLINT(readability-function-cognitive-complexity)
// assert(s1 >= minTarget);
// Check for touching
if (timeLoEvalDistance <= maxTarget) {
if (timeLoEvalDistance < minTarget) {
stats.sum_finder_iters += pbIter;
return ToiOutput{timeLo, stats, ToiOutput::e_belowMinTarget};
}
// Victory! timeLo should hold the TOI (could be 0.0).
stats.sum_finder_iters += pbIter;
return ToiOutput{timeLo, stats, ToiOutput::e_touching};
return ToiOutput{timeLo, stats, (timeLoEvalDistance < minTarget)?
ToiOutput::e_belowMinTarget: ToiOutput::e_touching};
}

// Now: timeLoEvalDistance > maxTarget
Expand Down

0 comments on commit 8d9a2c9

Please sign in to comment.