Minor optimization

This commit is contained in:
Alessandro Ranellucci 2014-06-10 00:54:37 +02:00
parent 3599bd0bae
commit af1a47c461

View File

@ -44,7 +44,12 @@ sub region {
sub make_slices { sub make_slices {
my $self = shift; my $self = shift;
my $slices = union_ex([ map $_->p, map @{$_->slices}, @{$self->regions} ]); my $slices;
if (@{$self->regions} == 1) {
$slices = [ map $_->expolygon->clone, @{$self->regions->[0]->slices} ];
} else {
$slices = union_ex([ map $_->p, map @{$_->slices}, @{$self->regions} ]);
}
# sort slices # sort slices
$slices = [ @$slices[@{chained_path([ map $_->contour->first_point, @$slices ])}] ]; $slices = [ @$slices[@{chained_path([ map $_->contour->first_point, @$slices ])}] ];