From 150690721277165e9adc8cd3a1a50a1eae2f04cb Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Thu, 11 Jul 2013 16:48:44 +0200 Subject: [PATCH] More incomplete work to make the plater work with XS data --- lib/Slic3r/ExPolygon.pm | 5 ++++- lib/Slic3r/Geometry.pm | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Slic3r/ExPolygon.pm b/lib/Slic3r/ExPolygon.pm index 19b3a90b6..e7abac998 100644 --- a/lib/Slic3r/ExPolygon.pm +++ b/lib/Slic3r/ExPolygon.pm @@ -329,7 +329,10 @@ sub scale { sub rotate { my $self = shift; - $_->rotate(@_) for @{$self->expolygons}; + my ($angle, $center) = @_; + + $center = Slic3r::Point::XS->new(@$center) if ref($center) ne 'Slic3r::Point::XS'; + $_->rotate($angle, $center) for @{$self->expolygons}; $self; } diff --git a/lib/Slic3r/Geometry.pm b/lib/Slic3r/Geometry.pm index 3c1476ffd..337b0b564 100644 --- a/lib/Slic3r/Geometry.pm +++ b/lib/Slic3r/Geometry.pm @@ -374,7 +374,7 @@ sub rad2deg_dir { sub rotate_points { my ($radians, $center, @points) = @_; - $center ||= [0,0]; + $center //= [0,0]; return map { [ $center->[X] + cos($radians) * ($_->[X] - $center->[X]) - sin($radians) * ($_->[Y] - $center->[Y]),