orcaslicer/lib/Slic3r/ExtrusionLoop.pm

56 lines
1 KiB
Perl
Raw Normal View History

package Slic3r::ExtrusionLoop;
2013-07-15 14:21:09 +00:00
use strict;
use warnings;
use Slic3r::Geometry qw(same_point);
2013-07-15 14:21:09 +00:00
sub polygon { $_[0] }
# class or object method
sub pack {
my $self = shift;
if (ref $self) {
2013-07-15 14:21:09 +00:00
return $self;
} else {
return $self->new(@_);
}
}
2013-03-11 11:47:27 +00:00
# no-op
sub unpack { $_[0] }
sub split_at_index {
my $self = shift;
return Slic3r::ExtrusionPath->new(
2013-07-15 14:21:09 +00:00
polyline => $self->as_polygon->split_at_index(@_),
role => $self->role,
flow_spacing => $self->flow_spacing,
2013-07-15 14:21:09 +00:00
height => $self->height,
);
}
sub split_at {
my $self = shift;
return Slic3r::ExtrusionPath->new(
2013-07-15 14:21:09 +00:00
polyline => $self->as_polygon->split_at(@_),
role => $self->role,
flow_spacing => $self->flow_spacing,
2013-07-15 14:21:09 +00:00
height => $self->height,
);
}
2012-02-19 11:03:36 +00:00
sub split_at_first_point {
my $self = shift;
return $self->split_at_index(0);
2012-02-19 11:03:36 +00:00
}
sub first_point {
my $self = shift;
return $self->polygon->[0];
}
1;