Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2013-11-24 01:43:30 +0400
committerAlessandro Ranellucci <aar@cpan.org>2013-11-24 01:43:30 +0400
commit97c65bac90191f5d286fd3f24c31c486e76d5c12 (patch)
tree6591f4b7147af9a8129a770b246de035e33c9162
parentdc049dfa1e11a5c907afdcb17b9cd9ebd00333ae (diff)
Do perimeters one island at time instead of doing all holes before all contours
-rw-r--r--lib/Slic3r/Layer/Region.pm19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm
index 312dce32a..b10b2dac5 100644
--- a/lib/Slic3r/Layer/Region.pm
+++ b/lib/Slic3r/Layer/Region.pm
@@ -242,7 +242,21 @@ sub make_perimeters {
)};
my @loops = ();
+
foreach my $polynode (@nodes) {
+ # if this is an external contour find all holes belonging to this contour(s)
+ # and prepend them
+ if ($is_contour && $depth == 0) {
+ # $polynode is the outermost loop of an island
+ my @holes = ();
+ for (my $i = 0; $i <= $#$holes_pt; $i++) {
+ if ($polynode->{outer}->encloses_point($holes_pt->[$i]{outer}->first_point)) {
+ push @holes, splice @$holes_pt, $i, 1; # remove from candidates to reduce complexity
+ $i--;
+ }
+ }
+ push @loops, reverse map $traverse->([$_], 0), @holes;
+ }
push @loops, $traverse->($polynode->{children}, $depth+1, $is_contour);
# return ccw contours and cw holes
@@ -272,10 +286,7 @@ sub make_perimeters {
};
# order loops from inner to outer (in terms of object slices)
- my @loops = (
- (reverse $traverse->($holes_pt, 0)),
- $traverse->($contours_pt, 0, 1),
- );
+ my @loops = $traverse->($contours_pt, 0, 1);
# if brim will be printed, reverse the order of perimeters so that
# we continue inwards after having finished the brim