From 2d130061edaa011d4f5d0a69923e7f1ab03a6507 Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Sat, 25 Feb 2012 16:14:28 +0100
Subject: [PATCH] Increase small holes threshold to holes having a 6.5mm radius

---
 lib/Slic3r.pm           | 2 +-
 lib/Slic3r/Perimeter.pm | 6 +-----
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm
index ec74a4f7f..248210165 100644
--- a/lib/Slic3r.pm
+++ b/lib/Slic3r.pm
@@ -78,7 +78,7 @@ our $infill_acceleration    = 50;   # mm/s^2
 
 # accuracy options
 our $resolution             = 0.00000001;
-our $small_perimeter_area   = (5 / $resolution) ** 2;
+our $small_perimeter_area   = ((6.5 / $resolution)**2)*PI;
 our $layer_height           = 0.4;
 our $first_layer_height_ratio = 1;
 our $infill_every_layers    = 1;
diff --git a/lib/Slic3r/Perimeter.pm b/lib/Slic3r/Perimeter.pm
index dd9a9f314..20b593ba6 100644
--- a/lib/Slic3r/Perimeter.pm
+++ b/lib/Slic3r/Perimeter.pm
@@ -6,8 +6,6 @@ use Slic3r::Geometry qw(X Y PI shortest_path scale unscale);
 use Slic3r::Geometry::Clipper qw(diff_ex);
 use XXX;
 
-my $HOLE_COMPENSATION_THRESHOLD;
-
 sub make_perimeter {
     my $self = shift;
     my ($layer) = @_;
@@ -36,8 +34,6 @@ sub make_perimeter {
         map [ $_->contour->[0], $_ ], @{$layer->slices},
     ])};
     
-    $HOLE_COMPENSATION_THRESHOLD ||= ((scale 6.5)**2)*PI;
-    
     # for each island:
     foreach my $surface (@surfaces) {
         my @last_offsets = ($surface->expolygon);
@@ -46,7 +42,7 @@ sub make_perimeter {
         # experimental hole compensation (see ArcCompensation in the RepRap wiki)
         foreach my $hole ($last_offsets[0]->holes) {
             my $area = abs($hole->area);last;
-            next unless $area <= $HOLE_COMPENSATION_THRESHOLD;
+            next unless $area <= $Slic3r::small_perimeter_area;
             my $radius = sqrt($area / PI);
             my $new_radius = (scale($Slic3r::flow_width) + sqrt((scale($Slic3r::flow_width)**2) + (4*($radius**2)))) / 2;
             @$hole = map Slic3r::Point->new($_), @{ +($hole->offset(+ ($new_radius - $radius)))[0] };