From b9ec61241689a74435597df581fdfd0175090f6e Mon Sep 17 00:00:00 2001 From: Arthur Date: Fri, 10 Jan 2025 14:14:07 +0800 Subject: [PATCH] ENH: draw thin walls after normal walls jira: STUDIO-9642 Change-Id: I8e8fc58f1c7e4ae4bb2a59ec8dd200a016b64568 --- src/libslic3r/PerimeterGenerator.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp index 3034fdfb7..83f03c233 100644 --- a/src/libslic3r/PerimeterGenerator.cpp +++ b/src/libslic3r/PerimeterGenerator.cpp @@ -643,13 +643,24 @@ static ExtrusionEntityCollection traverse_loops(const PerimeterGenerator &perime } // Append thin walls to the nearest-neighbor search (only for first iteration) + Point zero_point(0, 0); + if (! thin_walls.empty()) { + BoundingBox bbox; + for (auto &entity : coll.entities) { bbox.merge(entity->as_polyline().bounding_box()); } + for (auto& thin_wall : thin_walls) { + // find the corner of bbox that's farthest from the thin wall + Point corner_far = bbox.min; + if ((corner_far.cast() - thin_wall.first_point().cast()).squaredNorm() < + (bbox.max.cast() - thin_wall.first_point().cast()).squaredNorm()) + corner_far = bbox.max; + zero_point = corner_far; + } variable_width(thin_walls, erExternalPerimeter, perimeter_generator.ext_perimeter_flow, coll.entities); thin_walls.clear(); } // Traverse children and build the final collection. - Point zero_point(0, 0); std::vector> chain = chain_extrusion_entities(coll.entities, &zero_point); ExtrusionEntityCollection out; for (const std::pair &idx : chain) {