Skip to content

Commit

Permalink
Bugfix: some bridges being very close could lead to overlapping infill
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Nov 29, 2011
1 parent d168ecb commit 2970e31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
6 changes: 6 additions & 0 deletions lib/Slic3r/Fill.pm
Expand Up @@ -63,6 +63,12 @@ sub make_fill {
);
}

# subtract any other surface already processed
$union = diff_ex(
[ map @$_, @$union ],
[ map $_->p, @surfaces ],
);

push @surfaces, map Slic3r::Surface->cast_from_expolygon($_,
surface_type => $group->[0]->surface_type,
bridge_angle => $group->[0]->bridge_angle,
Expand Down
22 changes: 9 additions & 13 deletions lib/Slic3r/Surface.pm
Expand Up @@ -55,22 +55,18 @@ sub group {
my $params = ref $_[0] eq 'HASH' ? shift(@_) : {};
my (@surfaces) = @_;

my $unique_type = sub {
($params->{merge_solid} && $_[0]->surface_type =~ /top|bottom|solid/
? 'solid' : $_[0]->surface_type) . "_" . ($_[0]->bridge_angle || '')
. "_" . $_[0]->depth_layers;
};
my @unique_types = ();
my %unique_types = ();
foreach my $surface (@surfaces) {
my $type = $unique_type->($surface);
push @unique_types, $type unless grep $_ eq $type, @unique_types;
my $type = ($params->{merge_solid} && $surface->surface_type =~ /top|bottom|solid/)
? 'solid'
: $surface->surface_type;
$type .= "_" . ($_[0]->bridge_angle || '');
$type .= "_" . $_[0]->depth_layers;
$unique_types{$type} ||= [];
push @{ $unique_types{$type} }, $surface;
}

my @groups = ();
foreach my $type (@unique_types) {
push @groups, [ grep { $unique_type->($_) eq $type } @surfaces ];
}
return @groups;
return values %unique_types;
}

sub add_hole {
Expand Down

0 comments on commit 2970e31

Please sign in to comment.