diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2013-07-26 02:13:24 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2013-07-26 02:13:24 +0400 |
commit | 37bf0fa53ba19f36db3208881aabb16faf62ce36 (patch) | |
tree | 0b88825732b79d60e9ae0f2c2d21922194621f65 /lib | |
parent | 8fe228fceeca212242a8b572260e8a50efdb0842 (diff) |
Bugfix: medial axis thin wall detection was triggered when not needed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Slic3r/Layer/Region.pm | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Slic3r/Layer/Region.pm b/lib/Slic3r/Layer/Region.pm index 9e76f09f1..16baf95d9 100644 --- a/lib/Slic3r/Layer/Region.pm +++ b/lib/Slic3r/Layer/Region.pm @@ -93,21 +93,21 @@ sub make_surfaces { # detect thin walls by offsetting slices by half extrusion inwards if ($Slic3r::Config->thin_walls) { - my $width = $self->perimeter_flow->scaled_width; + $self->thin_walls([]); + # we use spacing here because there could be a case where + # the slice collapses with width but doesn't collapse with spacing, + # thus causing both perimeters and medial axis to be generated + my $width = $self->perimeter_flow->scaled_spacing; my $diff = diff_ex( [ map $_->p, @{$self->slices} ], - [ offset2([ map @$_, map $_->expolygon, @{$self->slices} ], -$width, +$width) ], + [ offset2([ map $_->p, @{$self->slices} ], -$width*0.5, +$width*0.5) ], 1, ); - $self->thin_walls([]); - if (@$diff) { - my $area_threshold = $self->perimeter_flow->scaled_spacing ** 2; - @$diff = grep $_->area > ($area_threshold), @$diff; - - @{$self->thin_walls} = map $_->medial_axis($self->perimeter_flow->scaled_width), @$diff; - - Slic3r::debugf " %d thin walls detected\n", scalar(@{$self->thin_walls}) if @{$self->thin_walls}; + my $area_threshold = $width ** 2; + if (@$diff = grep { $_->area > $area_threshold } @$diff) { + @{$self->thin_walls} = map $_->medial_axis($width), @$diff; + Slic3r::debugf " %d thin walls detected\n", scalar(@{$self->thin_walls}); } } |