diff options
author | Alessandro Ranellucci <aar@cpan.org> | 2011-12-01 22:40:45 +0400 |
---|---|---|
committer | Alessandro Ranellucci <aar@cpan.org> | 2011-12-01 22:40:45 +0400 |
commit | 133f3a0495ed293c8dfbfbd61347921711fa28b5 (patch) | |
tree | 1e5eef39ed6499a7a4e472d1c528824a3ed3b9e8 /lib/Slic3r | |
parent | b03afc7f1cbcb3920ba3902aae8046db9f1df7da (diff) |
Bugfix: Clipper error occurred under certain circumstances
Diffstat (limited to 'lib/Slic3r')
-rw-r--r-- | lib/Slic3r/ExPolygon.pm | 8 | ||||
-rw-r--r-- | lib/Slic3r/Layer.pm | 6 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/Slic3r/ExPolygon.pm b/lib/Slic3r/ExPolygon.pm index ba46f7095..6fc391a41 100644 --- a/lib/Slic3r/ExPolygon.pm +++ b/lib/Slic3r/ExPolygon.pm @@ -55,8 +55,14 @@ sub offset { sub safety_offset { my $self = shift; + + # we're offsetting contour and holes separately + # because Clipper doesn't return polygons in the same order as + # we feed them to it + return (ref $self)->new( - @{ Slic3r::Geometry::Clipper::safety_offset([@$self]) }, + $self->contour->safety_offset, + @{ Slic3r::Geometry::Clipper::safety_offset([$self->holes]) }, ); } diff --git a/lib/Slic3r/Layer.pm b/lib/Slic3r/Layer.pm index 9ae5d090b..6c6511986 100644 --- a/lib/Slic3r/Layer.pm +++ b/lib/Slic3r/Layer.pm @@ -2,7 +2,7 @@ package Slic3r::Layer; use Moo; use Math::Clipper ':all'; -use Slic3r::Geometry qw(collinear X Y A B PI); +use Slic3r::Geometry qw(scale collinear X Y A B PI); use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex PFT_EVENODD); use XXX; @@ -278,8 +278,8 @@ sub process_bridges { # now, extend our bridge by taking a portion of supporting surfaces { # offset the bridge by the specified amount of mm (minimum 3) - my $bridge_overlap = 3 / $Slic3r::resolution; - my ($bridge_offset) = $expolygon->contour->offset($bridge_overlap, $Slic3r::resolution * 100, JT_MITER, 2); + my $bridge_overlap = scale 3; + my ($bridge_offset) = $expolygon->contour->offset($bridge_overlap); # calculate the new bridge my $intersection = intersection_ex( |