diff --git a/lib/Slic3r/Geometry/Clipper.pm b/lib/Slic3r/Geometry/Clipper.pm index 17b671a84..46f7f0d87 100644 --- a/lib/Slic3r/Geometry/Clipper.pm +++ b/lib/Slic3r/Geometry/Clipper.pm @@ -8,7 +8,7 @@ our @EXPORT_OK = qw(explode_expolygon explode_expolygons safety_offset offset diff_ex diff union_ex intersection_ex xor_ex PFT_EVENODD JT_MITER JT_ROUND is_counter_clockwise); -use Math::Clipper 1.03 ':all'; +use Math::Clipper 1.05 ':all'; use Slic3r::Geometry qw(scale); our $clipper = Math::Clipper->new; diff --git a/lib/Slic3r/Polygon.pm b/lib/Slic3r/Polygon.pm index aa8e73f25..110ba2b5c 100644 --- a/lib/Slic3r/Polygon.pm +++ b/lib/Slic3r/Polygon.pm @@ -37,6 +37,21 @@ sub lines { return @lines; } +sub is_counter_clockwise { + my $self = shift; + return Math::Clipper::is_counter_clockwise($self); +} + +sub make_counter_clockwise { + my $self = shift; + $self->reverse if !$self->is_counter_clockwise; +} + +sub make_clockwise { + my $self = shift; + $self->reverse if $self->is_counter_clockwise; +} + sub cleanup { my $self = shift; $self->merge_continuous_lines; diff --git a/lib/Slic3r/Polyline.pm b/lib/Slic3r/Polyline.pm index e0d63f5ae..7c416e782 100644 --- a/lib/Slic3r/Polyline.pm +++ b/lib/Slic3r/Polyline.pm @@ -66,21 +66,6 @@ sub reverse { @$self = CORE::reverse @$self; } -sub is_counter_clockwise { - my $self = shift; - return Math::Clipper::is_counter_clockwise($self); -} - -sub make_counter_clockwise { - my $self = shift; - $self->reverse if !$self->is_counter_clockwise; -} - -sub make_clockwise { - my $self = shift; - $self->reverse if $self->is_counter_clockwise; -} - sub nearest_point_to { my $self = shift; my ($point) = @_; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 497f6b3a7..667c73da8 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -222,8 +222,8 @@ sub detect_surfaces_type { # save surfaces to layer @{$layer->slices} = (@bottom, @top, @internal); - Slic3r::debugf " layer %d (%d sliced expolygons) has %d bottom, %d top and %d internal surfaces\n", - $layer->id, scalar(@{$layer->slices}), scalar(@bottom), scalar(@top), scalar(@internal); + Slic3r::debugf " layer %d has %d bottom, %d top and %d internal surfaces\n", + $layer->id, scalar(@bottom), scalar(@top), scalar(@internal); } # clip surfaces to the fill boundaries diff --git a/lib/Slic3r/TriangleMesh.pm b/lib/Slic3r/TriangleMesh.pm index ab04cf486..6e0aca0b9 100644 --- a/lib/Slic3r/TriangleMesh.pm +++ b/lib/Slic3r/TriangleMesh.pm @@ -245,8 +245,10 @@ sub make_loops { $line = $next_line; } while ($first_facet_index != $line->facet_index); - Slic3r::debugf " Discovered polygon of %d points\n", scalar(@points); push @polygons, Slic3r::Polygon->new(@points); + Slic3r::debugf " Discovered %s polygon of %d points\n", + ($polygons[-1]->is_counter_clockwise ? 'ccw' : 'cw'), scalar(@points) + if $Slic3r::debug; pop @polygons if !$polygons[-1]->cleanup; }