Revert "Refactor stagger concentric seams (#6432)"

This reverts commit bd8c2ffaeb.
This commit is contained in:
SoftFever 2025-07-30 23:33:21 +08:00
parent 282cdd111a
commit 13bd1a4d68

View file

@ -10,15 +10,12 @@
namespace Slic3r {
template<typename LINE_T>
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 &params,
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();
}