Bugfix: fill escapes perimeters. #139

This commit is contained in:
Alessandro Ranellucci 2012-03-04 11:26:11 +01:00
parent 4a4c4b4e7d
commit be9886eac3
3 changed files with 20 additions and 9 deletions

View file

@ -5,7 +5,7 @@ use warnings;
# an ExPolygon is a polygon with holes
use Math::Geometry::Voronoi;
use Slic3r::Geometry qw(X Y A B point_in_polygon);
use Slic3r::Geometry qw(X Y A B point_in_polygon same_line);
use Slic3r::Geometry::Clipper qw(union_ex JT_MITER);
# the constructor accepts an array of polygons
@ -93,6 +93,14 @@ sub encloses_point {
|| grep($_->point_on_segment($point), $self->holes));
}
sub encloses_line {
my $self = shift;
my ($line) = @_;
my $clip = $self->clip_line($line);
return @$clip == 1 && same_line($clip->[0], $line);
}
sub point_on_segment {
my $self = shift;
my ($point) = @_;