Bugfix: simplification of support areas could lead to complex polygons with bad orientation, thus causing wrong pattern clipping. #1032

This commit is contained in:
Alessandro Ranellucci 2013-03-14 14:27:08 +01:00
parent 0feef890b1
commit dc0f706789
3 changed files with 22 additions and 2 deletions

View file

@ -5,6 +5,7 @@ use warnings;
# an ExPolygon is a polygon with holes
use Boost::Geometry::Utils;
use List::Util qw(first);
use Math::Geometry::Voronoi;
use Slic3r::Geometry qw(X Y A B point_in_polygon same_line line_length epsilon);
use Slic3r::Geometry::Clipper qw(union_ex JT_MITER);
@ -54,6 +55,13 @@ sub clipper_expolygon {
};
}
sub is_valid {
my $self = shift;
return (!first { !$_->is_valid } @$self)
&& $self->contour->is_counter_clockwise
&& (!first { $_->is_counter_clockwise } $self->holes);
}
sub boost_polygon {
my $self = shift;
return Boost::Geometry::Utils::polygon(@$self);