Extrusion of perimeters

This commit is contained in:
Alessandro Ranellucci 2011-09-02 21:10:20 +02:00
parent 55a523e1fa
commit febd655e22
11 changed files with 206 additions and 5 deletions

View file

@ -1,6 +1,7 @@
package Slic3r::Line;
use Moose;
use Moose::Util::TypeConstraints;
use Scalar::Util qw(weaken);
has 'a' => (
@ -21,6 +22,11 @@ has 'polyline' => (
weak_ref => 1,
);
has 'solid_side' => (
is => 'rw',
isa => enum([qw(left right)]), # going from a to b
);
sub BUILD {
my $self = shift;
@ -45,6 +51,12 @@ sub coincides_with {
|| ($self->a->coincides_with($line->b) && $self->b->coincides_with($line->a));
}
sub has_endpoint {
my $self = shift;
my ($point) = @_;#printf " %s has endpoint %s: %s\n", $self->id, $point->id, ($point eq $self->a || $point eq $self->b);
return $point->coincides_with($self->a) || $point->coincides_with($self->b);
}
sub slope {
my $self = shift;
return undef if $self->b->x == $self->a->x; # line is vertical