diff --git a/src/LayerPlan.cpp b/src/LayerPlan.cpp index 56d7514509..1ef4b35bda 100644 --- a/src/LayerPlan.cpp +++ b/src/LayerPlan.cpp @@ -1151,7 +1151,9 @@ void LayerPlan::addWall( for (size_t piece = 0; piece < pieces; ++piece) { const double average_progress = (double(piece) + 0.5) / pieces; // How far along this line to sample the line width in the middle of this piece. - const coord_t line_width = p0.w_ + average_progress * delta_line_width; + // Round the line_width value to overcome floating point rounding issues, otherwise we may end up with slightly different values + // and the generated GCodePath objects will not be merged together, which some subsequent algorithms rely on (e.g. coasting) + const coord_t line_width = std::lrint(static_cast(p0.w_) + average_progress * static_cast(delta_line_width)); const Point2LL destination = p0.p_ + normal(line_vector, piece_length * (piece + 1)); if (is_small_feature) {