#2433 - Time Estimator: clamp accelerate/decelerate distances to avoid them to become negative

This commit is contained in:
Enrico Turri 2019-06-24 12:35:20 +02:00
parent 6b0d75127b
commit 1459ad65c6

View File

@ -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.