New ->scale() method for ExPolygon::XS

This commit is contained in:
Alessandro Ranellucci 2013-07-11 14:08:11 +02:00
parent 5409c27852
commit e0052b01d3
3 changed files with 24 additions and 1 deletions

View file

@ -4,7 +4,7 @@ use strict;
use warnings;
use Slic3r::XS;
use Test::More tests => 5;
use Test::More tests => 6;
my $square = [ # ccw
[100, 100],
@ -30,4 +30,10 @@ my $clone = $expolygon->clone;
is_deeply [ @$clone ], [$square, $hole_in_square], 'clone';
# TODO: check that modifying the clone doesn't modify the original one
$expolygon->scale(1.5);
is_deeply [ @$expolygon ], [
[map [ 1.5*$_->[0], 1.5*$_->[1] ], @$square],
[map [ 1.5*$_->[0], 1.5*$_->[1] ], @$hole_in_square]
], 'scale';
__END__