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) {