Polyline.pm 419 B

123456789101112131415161718
  1. package Slic3r::Polyline;
  2. use strict;
  3. use warnings;
  4. use Slic3r::Geometry qw(X Y);
  5. sub new_scale {
  6. my $class = shift;
  7. my @points = map { ref($_) eq 'Slic3r::Point' ? $_->pp : $_ } @_;
  8. return $class->new(map [ Slic3r::Geometry::scale($_->[X]), Slic3r::Geometry::scale($_->[Y]) ], @points);
  9. }
  10. sub dump_perl {
  11. my $self = shift;
  12. return sprintf "[%s]", join ',', map "[$_->[0],$_->[1]]", @$self;
  13. }
  14. 1;