diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp index c594b8b91e..4ddbb01d1c 100644 --- a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp +++ b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp @@ -268,13 +268,13 @@ void extrusion_paths_append(ExtrusionPaths &dst, const ClipperLib_Z::Paths &extr { for (const ClipperLib_Z::Path &extrusion_path : extrusion_paths) { ThickPolyline thick_polyline = Arachne::to_thick_polyline(extrusion_path); - Slic3r::append(dst, thick_polyline_to_extrusion_paths(thick_polyline, role, flow, scaled(0.05), 0)); + Slic3r::append(dst, thick_polyline_to_extrusion_paths(thick_polyline, role, flow, scaled(0.05), SCALED_EPSILON)); } } void extrusion_paths_append(ExtrusionPaths &dst, const Arachne::ExtrusionLine &extrusion, const ExtrusionRole role, const Flow &flow) { ThickPolyline thick_polyline = Arachne::to_thick_polyline(extrusion); - Slic3r::append(dst, thick_polyline_to_extrusion_paths(thick_polyline, role, flow, scaled(0.05), 0)); + Slic3r::append(dst, thick_polyline_to_extrusion_paths(thick_polyline, role, flow, scaled(0.05), SCALED_EPSILON)); } } // namespace Slic3r \ No newline at end of file diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 539679e8d4..0bbe601e20 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -25,7 +25,7 @@ ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_poly const coordf_t line_len = line.length(); if (line_len < SCALED_EPSILON) continue; - + double thickness_delta = fabs(line.a_width - line.b_width); if (thickness_delta > tolerance) { const auto segments = (unsigned int)ceil(thickness_delta / tolerance); @@ -37,18 +37,18 @@ ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_poly width.push_back(line.a_width); for (size_t j = 1; j < segments; ++j) { pp.push_back((line.a.cast() + (line.b - line.a).cast().normalized() * (j * seg_len)).cast()); - + coordf_t w = line.a_width + (j*seg_len) * (line.b_width-line.a_width) / line_len; width.push_back(w); width.push_back(w); } pp.push_back(line.b); width.push_back(line.b_width); - + assert(pp.size() == segments + 1u); assert(width.size() == segments*2); } - + // delete this line and insert new ones lines.erase(lines.begin() + i); for (size_t j = 0; j < segments; ++j) { @@ -57,18 +57,18 @@ ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_poly new_line.b_width = width[2*j+1]; lines.insert(lines.begin() + i + j, new_line); } - + -- i; continue; } - - const double w = fmax(line.a_width, line.b_width); + + const double w = fmax(line.a_width, line.b_width); + const Flow new_flow = (role == erOverhangPerimeter && flow.bridge()) ? flow : flow.with_width(unscale(w) + flow.height() * float(1. - 0.25 * PI)); if (path.polyline.points.empty()) { path.polyline.append(line.a); path.polyline.append(line.b); // Convert from spacing to extrusion width based on the extrusion model // of a square extrusion ended with semi circles. - Flow new_flow = (role == erOverhangPerimeter && flow.bridge()) ? flow : flow.with_width(unscale(w) + flow.height() * float(1. - 0.25 * PI)); #ifdef SLIC3R_DEBUG printf(" filling %f gap\n", flow.width); #endif @@ -76,10 +76,11 @@ ExtrusionPaths thick_polyline_to_extrusion_paths(const ThickPolyline &thick_poly path.width = new_flow.width(); path.height = new_flow.height(); } else { - thickness_delta = fabs(scale_(flow.width()) - w); + assert(path.width >= EPSILON); + thickness_delta = scaled(fabs(path.width - new_flow.width())); if (thickness_delta <= merge_tolerance) { - // the width difference between this line and the current flow width is - // within the accepted tolerance + // the width difference between this line and the current flow + // (of the previous line) width is within the accepted tolerance path.polyline.append(line.b); } else { // we need to initialize a new line