Finished porting BoundingBox to XS

This commit is contained in:
Alessandro Ranellucci 2014-01-07 12:48:09 +01:00
parent ea47f3b6e7
commit b17d06f9d1
24 changed files with 160 additions and 262 deletions

View file

@ -22,8 +22,8 @@ sub infill_direction {
my (@rotate, @shift);
$rotate[0] = Slic3r::Geometry::deg2rad($self->angle);
$rotate[1] = $self->bounding_box
? $self->bounding_box->center_2D
: $surface->expolygon->bounding_box->center_2D;
? $self->bounding_box->center
: $surface->expolygon->bounding_box->center;
@shift = @{$rotate[1]};
if (defined $self->layer_id) {

View file

@ -12,7 +12,7 @@ sub process_polyline {
my $self = shift;
my ($polyline, $bounding_box) = @_;
$_->[X] += $bounding_box->center_2D->[X] for @$polyline;
$_->[X] += $bounding_box->center->[X] for @$polyline;
}
1;

View file

@ -47,8 +47,10 @@ sub fill_surface {
# extend bounding box so that our pattern will be aligned with other layers
# $bounding_box->[X1] and [Y1] represent the displacement between new bounding box offset and old one
$bounding_box->extents->[X][MIN] -= $bounding_box->x_min % $m->{hex_width};
$bounding_box->extents->[Y][MIN] -= $bounding_box->y_min % $m->{pattern_height};
$bounding_box->merge_point(Slic3r::Point->new(
$bounding_box->x_min - ($bounding_box->x_min % $m->{hex_width}),
$bounding_box->y_min - ($bounding_box->y_min % $m->{pattern_height}),
));
}
my $x = $bounding_box->x_min;

View file

@ -33,7 +33,7 @@ sub fill_surface {
(ref $self) =~ /::([^:]+)$/;
my $path = "Math::PlanePath::$1"->new;
my @n = $self->get_n($path, [ map +($_ / $distance_between_lines), @{$bounding_box->bb} ]);
my @n = $self->get_n($path, [ map +($_ / $distance_between_lines), @{$bounding_box->min_point}, @{$bounding_box->max_point} ]);
my $polyline = Slic3r::Polyline->new(
map [ map {$_*$distance_between_lines} $path->n_to_xy($_) ], @n,

View file

@ -38,8 +38,10 @@ sub fill_surface {
);
} else {
# extend bounding box so that our pattern will be aligned with other layers
$bounding_box->extents->[X][MIN] -= $bounding_box->x_min % $line_spacing;
$bounding_box->extents->[Y][MIN] -= $bounding_box->y_min % $line_spacing;
$bounding_box->merge_point(Slic3r::Point->new(
$bounding_box->x_min - ($bounding_box->x_min % $line_spacing),
$bounding_box->y_min - ($bounding_box->y_min % $line_spacing),
));
}
# generate the basic pattern