Do all perimeters for each island/object at once without moving between multiple objects. #34

This commit is contained in:
Alessandro Ranellucci 2011-11-07 14:25:36 +01:00
parent d620b46beb
commit e860254780

View File

@ -22,8 +22,8 @@ sub make_perimeter {
# perimeters to outer); each item of this arrayref is an ExPolygon: # perimeters to outer); each item of this arrayref is an ExPolygon:
# @perimeters = ( # @perimeters = (
# [ # first object (identified by a single surface before offsetting) # [ # first object (identified by a single surface before offsetting)
# [ Slic3r::ExPolygon, Slic3r::ExPolygon... ], #item 0: outer loop # [ Slic3r::ExPolygon, Slic3r::ExPolygon... ], #depth 0: outer loop
# [ Slic3r::ExPolygon, Slic3r::ExPolygon... ], #item 1: inner loop # [ Slic3r::ExPolygon, Slic3r::ExPolygon... ], #depth 1: inner loop
# ], # ],
# [ # second object # [ # second object
# ... # ...
@ -57,22 +57,18 @@ sub make_perimeter {
} }
} }
# first generate paths for all holes, starting from external (innermost) perimeters # process one island (original surface) at time
foreach my $i (1..$Slic3r::perimeter_offsets) { foreach my $island (@perimeters) {
foreach my $hole (map $_->holes, map @{$_->[$i-1]}, @perimeters) { # do holes starting from innermost one
foreach my $hole (map $_->holes, map @$_, @$island) {
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($hole); push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($hole);
} }
}
# then generate paths for contours # do contours starting from innermost one
# this time we do something different: we do contour loops for one foreach my $contour (map $_->contour, map @$_, reverse @$island) {
# shape (that is, one original surface) at a time: we start from the
# innermost loop (that is, internal one), then without interrupting
# our path we go onto the outer loop and continue; this should ensure
# good surface quality
foreach my $contour (map $_->contour, map @$_, map @$_, @perimeters) {
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($contour); push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($contour);
} }
}
# generate skirt on bottom layer # generate skirt on bottom layer
if ($layer->id == 0 && $Slic3r::skirts > 0 && @{ $layer->surfaces }) { if ($layer->id == 0 && $Slic3r::skirts > 0 && @{ $layer->surfaces }) {