Fix islands not being ordered efficiently with the logic that completes each of them before moving to the next one (which is now the default behavior). #1137

This commit is contained in:
Alessandro Ranellucci 2014-04-25 19:11:17 +02:00
parent 2a2ba15665
commit f6897a346a
4 changed files with 17 additions and 4 deletions

View file

@ -284,8 +284,16 @@ sub make_perimeters {
# use a nearest neighbor search to order these children
# TODO: supply second argument to chained_path() too?
my $sorted_collection = $collection->chained_path_indices(0);
my @orig_indices = @{$sorted_collection->orig_indices};
# Optimization: since islands are going to be sorted by slice anyway in the
# G-code export process, we skip chained_path here
my ($sorted_collection, @orig_indices);
if ($is_contour && $depth == 0) {
$sorted_collection = $collection;
@orig_indices = (0..$#$sorted_collection);
} else {
$sorted_collection = $collection->chained_path_indices(0);
@orig_indices = @{$sorted_collection->orig_indices};
}
my @loops = ();
foreach my $loop (@$sorted_collection) {