From da43cd70b20c4ad8ac5e1b6800e6ab3dfd371179 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 1 May 2012 15:23:17 +0200 Subject: [PATCH] Prevent tiny extrusion points. #323 --- lib/Slic3r/Layer.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index efeea2093..370964f41 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -142,14 +142,17 @@ sub make_surfaces { 1, ); - # TODO: remove very small expolygons from diff before attempting to do medial axis - # (benchmark first) - push @{$self->thin_walls}, - grep $_, - map $_->medial_axis(scale $Slic3r::flow_width), - @$diff; - - Slic3r::debugf " %d thin walls detected\n", scalar(@{$self->thin_walls}) if @{$self->thin_walls}; + if (@$diff) { + my $area_threshold = scale($Slic3r::flow_spacing) ** 2; + @$diff = grep $_->area > ($area_threshold), @$diff; + + push @{$self->thin_walls}, + grep $_, + map $_->medial_axis(scale $Slic3r::flow_width), + @$diff; + + Slic3r::debugf " %d thin walls detected\n", scalar(@{$self->thin_walls}) if @{$self->thin_walls}; + } } if (0) {