1
package Slic3r::Polyline;
5
use List::Util qw(first);
6
use Slic3r::Geometry qw(X Y PI epsilon);
7
use Slic3r::Geometry::Clipper qw(JT_SQUARE);
11
my @points = map { ref($_) eq 'Slic3r::Point' ? $_->pp : $_ } @_;
12
return $class->new(map [ Slic3r::Geometry::scale($_->[X]), Slic3r::Geometry::scale($_->[Y]) ], @points);
17
return sprintf "LINESTRING((%s))", join ',', map "$_->[0] $_->[1]", @$self;
22
return Slic3r::Geometry::BoundingBox->new_from_points([ @$self ]);
27
return [ Slic3r::Geometry::size_2D($self) ];
33
# Check that each segment's direction is equal to the line connecting
34
# first point and last point. (Checking each line against the previous
35
# one would have caused the error to accumulate.)
36
my $dir = Slic3r::Line->new($self->first_point, $self->last_point)->direction;
37
return !defined first { !$_->parallel_to($dir) } @{$self->lines};