From 37bf0fa53ba19f36db3208881aabb16faf62ce36 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 26 Jul 2013 00:13:24 +0200 Subject: Bugfix: medial axis thin wall detection was triggered when not needed --- lib/Slic3r/Layer/Region.pm | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'lib') 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}); } } -- cgit v1.2.3