diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-11-29 14:36:52 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-11-29 14:36:52 +0400 |
commit | 2970e315402d01bc492e30c9d98546bcee6bbea1 (patch) | |
tree | 9723c360fae19eca895ad5064439dd47a446173a /lib/Slic3r/Surface.pm | |
parent | d168ecbb4e9b7b9b808e3de904583d9cfc014708 (diff) |
Bugfix: some bridges being very close could lead to overlapping infill
Diffstat (limited to 'lib/Slic3r/Surface.pm')
-rw-r--r-- | lib/Slic3r/Surface.pm | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/lib/Slic3r/Surface.pm b/lib/Slic3r/Surface.pm index ef5d5c333..b6e16f5a1 100644 --- a/lib/Slic3r/Surface.pm +++ b/lib/Slic3r/Surface.pm @@ -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 { |