From 68d0f2da2bca190f85078c471348e037d4df9f9c Mon Sep 17 00:00:00 2001 From: PavelMikus Date: Thu, 6 Apr 2023 15:54:16 +0200 Subject: [PATCH] Improve bridge over infill filtering, fix tests --- src/libslic3r/PrintObject.cpp | 11 +++++++++-- tests/fff_print/test_perimeters.cpp | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index 9a47325ef..0b0610647 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -2147,20 +2147,27 @@ void PrintObject::bridge_over_infill() expansion_area = closing(expansion_area, SCALED_EPSILON); expansion_area = intersection(expansion_area, deep_infill_area); Polylines anchors = intersection_pl(infill_lines[lidx - 1], shrink(expansion_area, spacing)); + Polygons internal_unsupported_area = shrink(deep_infill_area, spacing * 4.5); #ifdef DEBUG_BRIDGE_OVER_INFILL debug_draw(std::to_string(lidx) + "_" + std::to_string(cluster_idx) + "_" + std::to_string(job_idx) + "_" + "_total_area", to_lines(total_fill_area), to_lines(expansion_area), to_lines(deep_infill_area), to_lines(anchors)); #endif - std::vector expanded_surfaces; expanded_surfaces.reserve(surfaces_by_layer[lidx].size()); for (const CandidateSurface &candidate : surfaces_by_layer[lidx]) { const Flow &flow = candidate.region->bridging_flow(frSolidInfill, true); Polygons area_to_be_bridge = expand(candidate.new_polys, flow.scaled_spacing()); area_to_be_bridge = intersection(area_to_be_bridge, deep_infill_area); - Polygons limiting_area = union_(area_to_be_bridge, expansion_area); + + area_to_be_bridge.erase(std::remove_if(area_to_be_bridge.begin(), area_to_be_bridge.end(), + [internal_unsupported_area](const Polygon &p) { + return intersection({p}, internal_unsupported_area).empty(); + }), + area_to_be_bridge.end()); + + Polygons limiting_area = union_(area_to_be_bridge, expansion_area); if (area_to_be_bridge.empty()) continue; diff --git a/tests/fff_print/test_perimeters.cpp b/tests/fff_print/test_perimeters.cpp index 99f0ddb99..4fa344d86 100644 --- a/tests/fff_print/test_perimeters.cpp +++ b/tests/fff_print/test_perimeters.cpp @@ -529,7 +529,7 @@ SCENARIO("Perimeters3", "[Perimeters]") auto config = Slic3r::DynamicPrintConfig::full_print_config_with({ { "skirts", 0 }, { "perimeters", 3 }, - { "layer_height", 0.4 }, + { "layer_height", 0.15 }, { "bridge_speed", 99 }, { "enable_dynamic_overhang_speeds", false }, // to prevent bridging over sparse infill