diff options
author | Enrico Turri <enricoturri@seznam.cz> | 2019-06-24 13:35:20 +0300 |
---|---|---|
committer | Enrico Turri <enricoturri@seznam.cz> | 2019-06-24 13:35:20 +0300 |
commit | 1459ad65c66e85770bddf07db462003df32899b0 (patch) | |
tree | 9ec0d3cd7944a3875d02e9fc96a9348c4c81bf2e /src/libslic3r | |
parent | 6b0d75127b5c8d122052fa06be990ad8cfeadeb6 (diff) |
#2433 - Time Estimator: clamp accelerate/decelerate distances to avoid them to become negative
Diffstat (limited to 'src/libslic3r')
-rw-r--r-- | src/libslic3r/GCodeTimeEstimator.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libslic3r/GCodeTimeEstimator.cpp b/src/libslic3r/GCodeTimeEstimator.cpp index 60d7a4cdf..b87305da8 100644 --- a/src/libslic3r/GCodeTimeEstimator.cpp +++ b/src/libslic3r/GCodeTimeEstimator.cpp @@ -125,8 +125,8 @@ namespace Slic3r { trapezoid.distance = distance; trapezoid.feedrate = feedrate; - float accelerate_distance = estimate_acceleration_distance(feedrate.entry, feedrate.cruise, acceleration); - float decelerate_distance = estimate_acceleration_distance(feedrate.cruise, feedrate.exit, -acceleration); + float accelerate_distance = std::max(0.0f, estimate_acceleration_distance(feedrate.entry, feedrate.cruise, acceleration)); + float decelerate_distance = std::max(0.0f, estimate_acceleration_distance(feedrate.cruise, feedrate.exit, -acceleration)); float cruise_distance = distance - accelerate_distance - decelerate_distance; // Not enough space to reach the nominal feedrate. |