From f50b0040efee2b8390bbdc466ef6aee0a67affff Mon Sep 17 00:00:00 2001
From: Alessandro Ranellucci <aar@cpan.org>
Date: Fri, 28 Sep 2012 15:27:33 +0200
Subject: [PATCH] Bugfix: the grow() method wasn't working properly, causing
 bad brim/support material interface. #639

---
 lib/Slic3r/Polyline.pm | 2 +-
 lib/Slic3r/Print.pm    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/Slic3r/Polyline.pm b/lib/Slic3r/Polyline.pm
index 474b55d94..a870cd37b 100644
--- a/lib/Slic3r/Polyline.pm
+++ b/lib/Slic3r/Polyline.pm
@@ -88,7 +88,7 @@ sub length {
 # this only applies to polylines
 sub grow {
     my $self = shift;
-    return Slic3r::Polygon->new(@$self, CORE::reverse @$self[1..-2])->offset(@_);
+    return Slic3r::Polygon->new(@$self, CORE::reverse @$self[1..($#$self-1)])->offset(@_);
 }
 
 sub nearest_point_to {
diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm
index 4c8cc0ba5..cd383c4aa 100644
--- a/lib/Slic3r/Print.pm
+++ b/lib/Slic3r/Print.pm
@@ -594,6 +594,7 @@ sub make_brim {
             polygon => Slic3r::Polygon->new($_),
             role    => EXTR_ROLE_SKIRT,
         ) for @{Math::Clipper::offset(\@islands, $i * $flow->scaled_spacing, 100, JT_SQUARE)};
+        # TODO: we need the offset inwards/offset outwards logic to avoid overlapping extrusions
     }
 }