From 13bd1a4d6841a341401ef66a75ca4dbbece46c8c Mon Sep 17 00:00:00 2001 From: SoftFever Date: Wed, 30 Jul 2025 23:33:21 +0800 Subject: [PATCH] Revert "Refactor stagger concentric seams (#6432)" This reverts commit bd8c2ffaeb4c7c747ed253cc629ba85b307efd35. --- src/libslic3r/Fill/FillConcentric.cpp | 36 ++++++--------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/src/libslic3r/Fill/FillConcentric.cpp b/src/libslic3r/Fill/FillConcentric.cpp index 33863d4575..f7fe82ad5f 100644 --- a/src/libslic3r/Fill/FillConcentric.cpp +++ b/src/libslic3r/Fill/FillConcentric.cpp @@ -10,15 +10,12 @@ namespace Slic3r { template -int stagger_seam_index(int ind, LINE_T line, double shift, bool dir) +int stagger_seam_index(int ind, LINE_T line) { Point const *point = &line.points[ind]; double dist = 0; - while (dist < shift / SCALING_FACTOR) { - if (dir) - ind = (ind + 1) % line.points.size(); - else - ind = ind > 0 ? --ind : line.points.size() - 1; + while (dist < 0.5 / SCALING_FACTOR) { + ind = (ind + 1) % line.points.size(); Point const &next = line.points[ind]; dist += point->distance_to(next); point = &next; @@ -26,8 +23,6 @@ int stagger_seam_index(int ind, LINE_T line, double shift, bool dir) return ind; } -#define STAGGER_SEAM_THRESHOLD 0.9 - void FillConcentric::_fill_surface_single( const FillParams ¶ms, unsigned int thickness_layers, @@ -60,20 +55,8 @@ void FillConcentric::_fill_surface_single( // split paths using a nearest neighbor search size_t iPathFirst = polylines_out.size(); Point last_pos(0, 0); - - double min_nozzle_diameter = 0.0; - bool dir = false; - if (this->print_config != nullptr && params.density >= STAGGER_SEAM_THRESHOLD) { - min_nozzle_diameter = *std::min_element(print_config->nozzle_diameter.values.begin(), print_config->nozzle_diameter.values.end()); - dir = rand() % 2; - } - for (const Polygon &loop : loops) { - int ind = (this->print_config != nullptr && params.density > STAGGER_SEAM_THRESHOLD) ? - stagger_seam_index(last_pos.nearest_point_index(loop.points), loop, min_nozzle_diameter / 2, dir) : - last_pos.nearest_point_index(loop.points); - - polylines_out.emplace_back(loop.split_at_index(ind)); + polylines_out.emplace_back(loop.split_at_index(stagger_seam_index(last_pos.nearest_point_index(loop.points), loop))); last_pos = polylines_out.back().last_point(); } @@ -135,18 +118,13 @@ void FillConcentric::_fill_surface_single(const FillParams& params, // Split paths using a nearest neighbor search. size_t firts_poly_idx = thick_polylines_out.size(); Point last_pos(0, 0); - bool dir = rand() % 2; for (const Arachne::ExtrusionLine* extrusion : all_extrusions) { if (extrusion->empty()) continue; + ThickPolyline thick_polyline = Arachne::to_thick_polyline(*extrusion); - - if (extrusion->is_closed) { - int ind = (params.density >= STAGGER_SEAM_THRESHOLD) ? - stagger_seam_index(last_pos.nearest_point_index(thick_polyline.points), thick_polyline, min_nozzle_diameter / 2, dir) : - last_pos.nearest_point_index(thick_polyline.points); - thick_polyline.start_at_index(ind); - } + if (extrusion->is_closed) + thick_polyline.start_at_index(stagger_seam_index(last_pos.nearest_point_index(thick_polyline.points), thick_polyline)); thick_polylines_out.emplace_back(std::move(thick_polyline)); last_pos = thick_polylines_out.back().last_point(); }