Ported ExPolygon->contour and ExPolygon->holes

This commit is contained in:
Alessandro Ranellucci 2013-08-26 23:09:18 +02:00
parent 85011dfef3
commit da0b85c0d9
7 changed files with 14 additions and 18 deletions

View file

@ -10,21 +10,11 @@ use Math::Geometry::Voronoi;
use Slic3r::Geometry qw(X Y A B point_in_polygon same_line epsilon);
use Slic3r::Geometry::Clipper qw(union_ex JT_MITER);
sub contour {
my $self = shift;
return $self->[0];
}
sub holes {
my $self = shift;
return @$self[1..$#$self];
}
sub is_valid {
my $self = shift;
return (!first { !$_->is_valid } @$self)
&& $self->contour->is_counter_clockwise
&& (!first { $_->is_counter_clockwise } $self->holes);
&& (!first { $_->is_counter_clockwise } @{$self->holes});
}
# returns false if the expolygon is too tight to be printed