Bugfix: Clipper error occurred under certain circumstances

This commit is contained in:
Alessandro Ranellucci 2011-12-01 19:40:45 +01:00
parent b03afc7f1c
commit 133f3a0495
2 changed files with 10 additions and 4 deletions

View File

@ -55,8 +55,14 @@ sub offset {
sub safety_offset { sub safety_offset {
my $self = shift; 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( return (ref $self)->new(
@{ Slic3r::Geometry::Clipper::safety_offset([@$self]) }, $self->contour->safety_offset,
@{ Slic3r::Geometry::Clipper::safety_offset([$self->holes]) },
); );
} }

View File

@ -2,7 +2,7 @@ package Slic3r::Layer;
use Moo; use Moo;
use Math::Clipper ':all'; 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 Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex PFT_EVENODD);
use XXX; use XXX;
@ -278,8 +278,8 @@ sub process_bridges {
# now, extend our bridge by taking a portion of supporting surfaces # now, extend our bridge by taking a portion of supporting surfaces
{ {
# offset the bridge by the specified amount of mm (minimum 3) # offset the bridge by the specified amount of mm (minimum 3)
my $bridge_overlap = 3 / $Slic3r::resolution; my $bridge_overlap = scale 3;
my ($bridge_offset) = $expolygon->contour->offset($bridge_overlap, $Slic3r::resolution * 100, JT_MITER, 2); my ($bridge_offset) = $expolygon->contour->offset($bridge_overlap);
# calculate the new bridge # calculate the new bridge
my $intersection = intersection_ex( my $intersection = intersection_ex(