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

@ -5,6 +5,7 @@ use Slic3r::Geometry qw(PI);
has 'layer_id' => (is => 'rw');
has 'angle' => (is => 'rw', default => sub { $Slic3r::Config->fill_angle });
has 'bounding_box' => (is => 'ro', required => 1);
sub angles () { [0, PI/2] }
@ -15,7 +16,7 @@ sub infill_direction {
# set infill angle
my (@rotate, @shift);
$rotate[0] = Slic3r::Geometry::deg2rad($self->angle);
$rotate[1] = $surface->expolygon->bounding_box_center;
$rotate[1] = Slic3r::Geometry::bounding_box_center($self->bounding_box);
@shift = @{$rotate[1]};
if (defined $self->layer_id) {
@ -41,11 +42,9 @@ sub rotate_points {
my @rotate = @{$rotate_vector->[0]};
my @shift = @{$rotate_vector->[1]};
# rotate points as needed
if ($rotate[0]) {
$expolygon->rotate(@rotate);
$expolygon->translate(@shift);
}
# rotate points
$expolygon->rotate(@rotate);
$expolygon->translate(@shift);
}
sub rotate_points_back {
@ -54,10 +53,8 @@ sub rotate_points_back {
my @rotate = @{$rotate_vector->[0]};
my @shift = @{$rotate_vector->[1]};
if ($rotate[0]) {
@$paths = map [ Slic3r::Geometry::rotate_points(-$rotate[0], $rotate[1], @$_) ],
map [ Slic3r::Geometry::move_points([map -$_, @shift], @$_) ], @$paths;
}
@$paths = map [ Slic3r::Geometry::rotate_points(-$rotate[0], $rotate[1], @$_) ],
map [ Slic3r::Geometry::move_points([map -$_, @shift], @$_) ], @$paths;
}
sub adjust_solid_spacing {