From 5d3c8575c59145c7f1ed7c62116391cadeabfeef Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 23 Mar 2014 19:55:31 +0100 Subject: [PATCH] Bugfix: holes were not sorted using the nearest-neighbor search, resulting in inefficient paths. #1785 --- lib/Slic3r/Layer/Region.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index 34da08e21..baa775608 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -254,6 +254,10 @@ sub make_perimeters { $i--; } } + + # order holes efficiently + @holes = @holes[@{chained_path([ map {($_->{outer} // $_->{hole})->first_point} @holes ])}]; + push @loops, reverse map $traverse->([$_], 0, 0), @holes; }