2011-10-20 16:11:59 +00:00
|
|
|
package Slic3r::ExtrusionPath::Arc;
|
|
|
|
use Moo;
|
|
|
|
|
|
|
|
extends 'Slic3r::ExtrusionPath';
|
|
|
|
|
|
|
|
has 'center' => (is => 'ro', required => 1);
|
|
|
|
has 'radius' => (is => 'ro', required => 1);
|
|
|
|
has 'orientation' => (is => 'ro', required => 1); # cw/ccw
|
|
|
|
|
|
|
|
use Slic3r::Geometry qw(PI angle3points);
|
|
|
|
|
|
|
|
sub angle {
|
|
|
|
my $self = shift;
|
|
|
|
return angle3points($self->center, @{$self->points});
|
|
|
|
}
|
|
|
|
|
|
|
|
sub length {
|
|
|
|
my $self = shift;
|
|
|
|
|
2011-12-22 11:09:01 +00:00
|
|
|
if($self->orientation eq 'ccw') {
|
|
|
|
return $self->radius * $self->angle;
|
|
|
|
} else {
|
|
|
|
return $self->radius * (2*PI() - $self->angle);
|
|
|
|
}
|
2011-10-20 16:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|