diff --git a/lib/Slic3r/Fill/Concentric.pm b/lib/Slic3r/Fill/Concentric.pm index a7d1c0062..ef61eb808 100644 --- a/lib/Slic3r/Fill/Concentric.pm +++ b/lib/Slic3r/Fill/Concentric.pm @@ -29,7 +29,7 @@ sub fill_surface { # compensate the overlap which is good for rectilinear but harmful for concentric # where the perimeter/infill spacing should be equal to any other loop spacing - my @loops = my @last = @{offset($expolygon, -&Slic3r::INFILL_OVERLAP_OVER_SPACING * $min_spacing / 2)}; + my @loops = my @last = @{offset(\@$expolygon, -&Slic3r::INFILL_OVERLAP_OVER_SPACING * $min_spacing / 2)}; while (@last) { push @loops, @last = @{offset2(\@last, -1.5*$distance, +0.5*$distance)}; } @@ -41,9 +41,9 @@ sub fill_surface { # order paths using a nearest neighbor search my @paths = (); - my $last_pos = [0,0]; + my $last_pos = Slic3r::Point->new(0,0); foreach my $loop (@loops) { - push @paths, $loop->split_at_index($last_pos->nearest_point_index($loop)); + push @paths, $loop->split_at_index($last_pos->nearest_point_index(\@$loop)); $last_pos = $paths[-1][-1]; } diff --git a/t/fill.t b/t/fill.t index 484217d0a..4885275dc 100644 --- a/t/fill.t +++ b/t/fill.t @@ -2,7 +2,7 @@ use Test::More; use strict; use warnings; -plan tests => 33; +plan tests => 34; BEGIN { use FindBin; @@ -155,11 +155,11 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ } 'chained path'; } -{ +for my $pattern (qw(hilbertcurve concentric)) { my $config = Slic3r::Config->new_from_defaults; - $config->set('fill_pattern', 'hilbertcurve'); + $config->set('fill_pattern', $pattern); my $print = Slic3r::Test::init_print('20mm_cube', config => $config); - ok Slic3r::Test::gcode($print), 'successful hilbertcurve infill generation'; + ok Slic3r::Test::gcode($print), "successful $pattern infill generation"; } {