Skip to content

Commit

Permalink
Add condition that the selected step is greater or equal to the compu…
Browse files Browse the repository at this point in the history
…ter minimum distance when selecting a step size.
  • Loading branch information
abrahamwolk committed Jul 11, 2023
1 parent 147815d commit be7ef9f
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public static double selectNiceStep(final double distance)
final double order_of_magnitude = Math.pow(10, Math.floor(log));
final double step = distance / order_of_magnitude;
for (int i=0; i<NICE_STEPS.length; ++i)
if (step >= NICE_THRESHOLDS[i])
if (step >= NICE_THRESHOLDS[i] && NICE_STEPS[i] * order_of_magnitude >= distance)
return NICE_STEPS[i] * order_of_magnitude;
return step * order_of_magnitude;
}
Expand Down

0 comments on commit be7ef9f

Please sign in to comment.