Align rectilinear and line infill across layers (new implementation). #712

This commit is contained in:
Alessandro Ranellucci 2013-04-18 17:34:21 +02:00
parent c723c07f8c
commit 430c825918
7 changed files with 57 additions and 51 deletions

View file

@ -3,7 +3,6 @@ use Moo;
extends 'Slic3r::Fill::Base';
has 'bounding_box' => (is => 'rw');
has 'cache' => (is => 'rw', default => sub {{}});
use Slic3r::Geometry qw(PI X1 Y1 X2 Y2 X Y scale);
@ -25,7 +24,7 @@ sub fill_surface {
my $cache_id = sprintf "d%s_s%s_a%s",
$params{density}, $params{flow_spacing}, $rotate_vector->[0][0];
if (!$self->cache->{$cache_id} || !defined $self->bounding_box) {
if (!$self->cache->{$cache_id}) {
# hexagons math
my $hex_side = $distance / (sqrt(3)/2);
@ -39,7 +38,7 @@ sub fill_surface {
# adjust actual bounding box to the nearest multiple of our hex pattern
# and align it so that it matches across layers
my $bounding_box = [ $self->bounding_box ? @{$self->bounding_box} : $expolygon->bounding_box ];
my $bounding_box = [ @{$self->bounding_box} ]; # clone
$bounding_box->[$_] = 0 for X1, Y1;
{
my $bb_polygon = Slic3r::Polygon->new_from_bounding_box($bounding_box);