Adopt XS containers everywhere (incomplete work)

This commit is contained in:
Alessandro Ranellucci 2013-07-16 09:49:34 +02:00
parent 339ba9e5c3
commit 9b582a11ff
30 changed files with 130 additions and 311 deletions

View file

@ -124,24 +124,22 @@ sub process_layer {
push @islands, { perimeters => [], fills => [] }
for 1 .. (@{$layer->slices} || 1); # make sure we have at least one island hash to avoid failure of the -1 subscript below
PERIMETER: foreach my $perimeter (@{$layerm->perimeters}) {
my $p = $perimeter->unpack;
for my $i (0 .. $#{$layer->slices}-1) {
if ($layer->slices->[$i]->contour->encloses_point($p->first_point)) {
push @{ $islands[$i]{perimeters} }, $p;
if ($layer->slices->[$i]->contour->encloses_point($perimeter->first_point)) {
push @{ $islands[$i]{perimeters} }, $perimeter;
next PERIMETER;
}
}
push @{ $islands[-1]{perimeters} }, $p; # optimization
push @{ $islands[-1]{perimeters} }, $perimeter; # optimization
}
FILL: foreach my $fill (@{$layerm->fills}) {
my $f = $fill->unpack;
for my $i (0 .. $#{$layer->slices}-1) {
if ($layer->slices->[$i]->contour->encloses_point($f->first_point)) {
push @{ $islands[$i]{fills} }, $f;
if ($layer->slices->[$i]->contour->encloses_point($fill->first_point)) {
push @{ $islands[$i]{fills} }, $fill;
next FILL;
}
}
push @{ $islands[-1]{fills} }, $f; # optimization
push @{ $islands[-1]{fills} }, $fill; # optimization
}
} else {
push @islands, {

View file

@ -53,7 +53,6 @@ sub BUILD {
# offset the island outwards to make the boundaries for external movements
$self->_outer->[$i] = [ offset([ $self->islands->[$i]->contour], $self->_outer_margin) ];
bless $_, 'Slic3r::Polygon' for @{ $self->_outer->[$i] };
# if internal motion is enabled, build a set of utility expolygons representing
# the outer boundaries (as contours) and the inner boundaries (as holes). whenever