Optimization in Polyline instantiation

This commit is contained in:
Alessandro Ranellucci 2013-07-05 14:29:57 +02:00
parent 27c421c27f
commit 8061cc6e30
14 changed files with 40 additions and 45 deletions

View file

@ -38,12 +38,12 @@ sub polygon {
my $self = shift;
my $e = $self->extents;
return Slic3r::Polygon->new([
return Slic3r::Polygon->new(
[ $e->[X][MIN], $e->[Y][MIN] ],
[ $e->[X][MAX], $e->[Y][MIN] ],
[ $e->[X][MAX], $e->[Y][MAX] ],
[ $e->[X][MIN], $e->[Y][MAX] ],
]);
);
}
# note to $self

View file

@ -83,7 +83,7 @@ sub diff {
$clipper->add_subject_polygons($subject);
$clipper->add_clip_polygons($safety_offset ? safety_offset($clip) : $clip);
return [
map Slic3r::Polygon->new($_),
map Slic3r::Polygon->new(@$_),
@{ $clipper->execute(CT_DIFFERENCE, PFT_NONZERO, PFT_NONZERO) },
];
}
@ -126,7 +126,7 @@ sub intersection {
$clipper->add_subject_polygons($subject);
$clipper->add_clip_polygons($safety_offset ? safety_offset($clip) : $clip);
return [
map Slic3r::Polygon->new($_),
map Slic3r::Polygon->new(@$_),
@{ $clipper->execute(CT_INTERSECTION, $jointype, $jointype) },
];
}