From f73febff7a4724ee3b5b2f41965f8e6c69cc4f8a Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sat, 17 Dec 2011 19:56:56 +0100 Subject: [PATCH] Always start concentric infill from the center. #120 --- lib/Slic3r/Fill/Concentric.pm | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/Fill/Concentric.pm b/lib/Slic3r/Fill/Concentric.pm index 3fd60862d..f530743dd 100644 --- a/lib/Slic3r/Fill/Concentric.pm +++ b/lib/Slic3r/Fill/Concentric.pm @@ -3,7 +3,7 @@ use Moo; extends 'Slic3r::Fill::Base'; -use Slic3r::Geometry qw(scale); +use Slic3r::Geometry qw(scale X1 Y1 X2 Y2); use XXX; sub fill_surface { @@ -12,6 +12,8 @@ sub fill_surface { # no rotation is supported for this infill pattern + my $bounding_box = [ $surface->expolygon->bounding_box ]; + my $scaled_flow_spacing = scale $params{flow_spacing}; my $distance = $scaled_flow_spacing / $params{density}; # TODO: adjust distance and flow width for solid surfaces @@ -38,7 +40,10 @@ sub fill_surface { # make paths my @paths = (); - my $cur_pos = Slic3r::Point->new(0,0); + my $cur_pos = Slic3r::Point->new( + ($bounding_box->[X1] + $bounding_box->[X2]) / 2, + ($bounding_box->[Y1] + $bounding_box->[Y2]) / 2, + ); foreach my $loop (map Slic3r::ExtrusionLoop->cast($_, role => 'fill'), @loops) { # find the point of the loop that is closest to the current extruder position $cur_pos = $loop->nearest_point_to($cur_pos);