From 0cfbe3f3c743848f8979259b0c49da8a638f9847 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Wed, 16 Oct 2024 16:12:43 +0100 Subject: [PATCH 1/2] Bug fix: Inner Outer Inner failed to reorder in certain edge cases --- src/libslic3r/PerimeterGenerator.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 3b9bc6daaa7..2e86557419e 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -3114,10 +3114,10 @@ void PerimeterGenerator::process_arachne() std::vector reordered_extrusions; // Get searching thresholds. For an external perimeter we take the middle of the external perimeter width, split it in two, add the spacing to the internal perimeter and add half the internal perimeter width. - // This should get us to the middle of the internal perimeter. We then scale by 10% up for safety margin. - coord_t threshold_external = (this->ext_perimeter_flow.scaled_width()/2+this->ext_perimeter_flow.scaled_spacing()+this->perimeter_flow.scaled_width()/2) * 1.1; - // For the intenal perimeter threshold, the distance is the perimeter width plus the spacing, scaled by 10% for safety margin. - coord_t threshold_internal = (this->perimeter_flow.scaled_width()+this->perimeter_flow.scaled_spacing()) * 1.1; + // This should get us to the middle of the internal perimeter. We then scale by 2% up for safety margin. + coord_t threshold_external = (this->ext_perimeter_flow.scaled_width()/2+this->ext_perimeter_flow.scaled_spacing()+this->perimeter_flow.scaled_width()/2)*1.02; + // For the intenal perimeter threshold, the distance is the perimeter width plus the spacing, scaled by 2% for safety margin. + coord_t threshold_internal = (this->perimeter_flow.scaled_width()+this->perimeter_flow.scaled_spacing()) * 1.02; // Re-order extrusions based on distance // Alorithm will aggresively optimise for the appearance of the outermost perimeter From 34a76afe51350d8ddc67e5edcfec6393bd230ac0 Mon Sep 17 00:00:00 2001 From: igiannakas Date: Tue, 22 Oct 2024 12:45:09 +0100 Subject: [PATCH 2/2] Fixing IOI proximity search spacing calculations --- src/libslic3r/PerimeterGenerator.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 2e86557419e..e5878bdfac3 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -3113,11 +3113,15 @@ void PerimeterGenerator::process_arachne() bringContoursToFront(ordered_extrusions); std::vector reordered_extrusions; - // Get searching thresholds. For an external perimeter we take the middle of the external perimeter width, split it in two, add the spacing to the internal perimeter and add half the internal perimeter width. - // This should get us to the middle of the internal perimeter. We then scale by 2% up for safety margin. - coord_t threshold_external = (this->ext_perimeter_flow.scaled_width()/2+this->ext_perimeter_flow.scaled_spacing()+this->perimeter_flow.scaled_width()/2)*1.02; - // For the intenal perimeter threshold, the distance is the perimeter width plus the spacing, scaled by 2% for safety margin. - coord_t threshold_internal = (this->perimeter_flow.scaled_width()+this->perimeter_flow.scaled_spacing()) * 1.02; + // Debug statement to print spacing values: + //printf("External threshold - Ext perimeter: %d Ext spacing: %d Int perimeter: %d Int spacing: %d\n", this->ext_perimeter_flow.scaled_width(),this->ext_perimeter_flow.scaled_spacing(),this->perimeter_flow.scaled_width(), this->perimeter_flow.scaled_spacing()); + + // Get searching thresholds. For an external perimeter we take the external perimeter spacing/2 plus the internal perimeter spacing/2 and expand by 3% to cover + // rounding errors + coord_t threshold_external = (this->ext_perimeter_flow.scaled_spacing()/2 + this->perimeter_flow.scaled_spacing()/2)*1.03; + + // For the intenal perimeter threshold, the distance is the internal perimeter spacing expanded by 3% to cover rounding errors. + coord_t threshold_internal = this->perimeter_flow.scaled_spacing() * 1.03; // Re-order extrusions based on distance // Alorithm will aggresively optimise for the appearance of the outermost perimeter