Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukáš Hejl <hejl.lukas@gmail.com>2022-07-14 09:57:53 +0300
committerLukáš Hejl <hejl.lukas@gmail.com>2022-07-14 10:10:22 +0300
commite2e127200341da2ad5d26390538fe766435acc21 (patch)
treefe1c43a1e7b6949474e2fb9c364f4785503bc265
parent200ab7441b6c1939ea8e9fdbd82f2a93691f49e2 (diff)
Fix of #8455 - Fixed the incorrect computation of the threshold for grouping ExtrusionPaths with the same extrusion width in thick_polyline_to_extrusion_paths() that was affecting Arachne and gap fill.
The previous behavior didn't merge two ExtrusionPaths with the same extrusion width, and it also could merge two ExtrusionPaths with different widths, which was unintentional, and it could also possibly create visible artifacts in some cases. Because simplification of ExtrusionLoop in GCode::extrude_loop is working on ExtrusionPath and not on whole ExtrusionLoop, so previous incorrect behavior was preventing simplification and removing small extrusions like in #8455.
-rw-r--r--src/libslic3r/Arachne/utils/ExtrusionLine.cpp4
-rw-r--r--src/libslic3r/PerimeterGenerator.cpp23
2 files changed, 14 insertions, 13 deletions
diff --git a/src/libslic3r/Arachne/utils/ExtrusionLine.cpp b/src/libslic3r/Arachne/utils/ExtrusionLine.cpp
index c594b8b91..4ddbb01d1 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<float>(0.05), 0));
+ Slic3r::append(dst, thick_polyline_to_extrusion_paths(thick_polyline, role, flow, scaled<float>(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<float>(0.05), 0));
+ Slic3r::append(dst, thick_polyline_to_extrusion_paths(thick_polyline, role, flow, scaled<float>(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 539679e8d..0bbe601e2 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<double>() + (line.b - line.a).cast<double>().normalized() * (j * seg_len)).cast<coord_t>());
-
+
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<float>(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<float>(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<double>(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