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
path: root/lib
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2013-07-26 02:03:28 +0400
committerAlessandro Ranellucci <aar@cpan.org>2013-07-26 02:03:28 +0400
commit8fe228fceeca212242a8b572260e8a50efdb0842 (patch)
treef6c6387c311371b6bfb9ba1f09a6f0e72eec549a /lib
parent2b8662cf0ce55bddd5fc70eeef0f76a6e05844c0 (diff)
Smarter ordering of gap fill
Diffstat (limited to 'lib')
-rw-r--r--lib/Slic3r/Fill.pm6
-rw-r--r--lib/Slic3r/Layer/Region.pm17
2 files changed, 18 insertions, 5 deletions
diff --git a/lib/Slic3r/Fill.pm b/lib/Slic3r/Fill.pm
index d88def835..5270c7250 100644
--- a/lib/Slic3r/Fill.pm
+++ b/lib/Slic3r/Fill.pm
@@ -196,8 +196,10 @@ sub make_fill {
}
# add thin fill regions
- push @fills, @{$layerm->thin_fills};
- push @fills_ordering_points, map $_->unpack->points->[0], @{$layerm->thin_fills};
+ if (@{ $layerm->thin_fills }) {
+ push @fills, Slic3r::ExtrusionPath::Collection->new(paths => $layerm->thin_fills);
+ push @fills_ordering_points, $fills[-1]->first_point;
+ }
# organize infill paths using a nearest-neighbor search
@fills = @fills[ chained_path(\@fills_ordering_points) ];
diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm
index 4441215d7..9e76f09f1 100644
--- a/lib/Slic3r/Layer/Region.pm
+++ b/lib/Slic3r/Layer/Region.pm
@@ -348,12 +348,11 @@ sub _fill_gaps {
my @infill = map $_->offset_ex(-0.5*$flow->scaled_width), @this_width;
foreach my $expolygon (@infill) {
- my @paths = $filler->fill_surface(
+ my ($params, @paths) = $filler->fill_surface(
Slic3r::Surface->new(expolygon => $expolygon),
density => 1,
flow_spacing => $flow->spacing,
);
- my $params = shift @paths;
push @{ $self->thin_fills },
map {
@@ -365,7 +364,19 @@ sub _fill_gaps {
role => EXTR_ROLE_GAPFILL,
height => $self->height,
flow_spacing => $params->{flow_spacing},
- ), @paths;
+ ),
+ # Split polylines into lines so that the chained_path() search
+ # at the final stage has more freedom and will choose starting
+ # points closer than last positions. OTOH, this will make such
+ # search slower. Probably, ExtrusionPath objects should support
+ # splitting nearby a given position so that we can choose the right
+ # entry point even in the middle of the path without needing a
+ # complex, slow, chained_path() search on all segments. TODO.
+ # Such logic will also avoid all the small travel moves that this
+ # line-splitting causes, and it will be applicable to other things
+ # too.
+ map Slic3r::Polyline->new(@$_)->lines,
+ @paths;
}
}