From 96ad37f6e00b5e32790e2082dc3911756e2c0358 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 23 Mar 2014 19:44:14 +0100 Subject: [PATCH] Bugfix: holes were not sorted using the nearest-neighbor search, resulting in inefficient paths. #1785 --- lib/Slic3r/Layer/Region.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index f9a55a067e..b815e45db7 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -261,6 +261,12 @@ sub make_perimeters { $i--; } } + + # order holes efficiently + @holes = @{Slic3r::Geometry::chained_path_items( + [ map [ ($_->{outer} // $_->{hole})->first_point, $_ ], @holes ], + )}; + push @loops, reverse map $traverse->([$_], 0), @holes; } push @loops, $traverse->($polynode->{children}, $depth+1, $is_contour);