Avoid overlapping regions (thanks Mike Sheldrake!). #726
This commit is contained in:
parent
1c50c8a401
commit
f0d2b0e5ea
@ -89,8 +89,12 @@ sub make_surfaces {
|
||||
foreach my $surface (@surfaces) {
|
||||
push @{$self->slices}, map Slic3r::Surface->new
|
||||
(expolygon => $_, surface_type => S_TYPE_INTERNAL),
|
||||
map $_->offset_ex(+$distance),
|
||||
$surface->expolygon->offset_ex(-2*$distance);
|
||||
@{union_ex([
|
||||
Slic3r::Geometry::Clipper::offset(
|
||||
[Slic3r::Geometry::Clipper::offset($surface->expolygon, -2*$distance)],
|
||||
+$distance,
|
||||
),
|
||||
])};
|
||||
}
|
||||
|
||||
# now detect thin walls by re-outgrowing offsetted surfaces and subtracting
|
||||
@ -187,14 +191,19 @@ sub make_perimeters {
|
||||
# offsetting a polygon can result in one or many offset polygons
|
||||
my @new_offsets = ();
|
||||
foreach my $expolygon (@last_offsets) {
|
||||
my @offsets = map $_->offset_ex(+0.5*$distance), $expolygon->noncollapsing_offset_ex(-1.5*$distance);
|
||||
my @offsets = @{union_ex([
|
||||
Slic3r::Geometry::Clipper::offset(
|
||||
[Slic3r::Geometry::Clipper::offset($expolygon, -1.5*$distance)],
|
||||
+0.5*$distance,
|
||||
),
|
||||
])};
|
||||
push @new_offsets, @offsets;
|
||||
|
||||
# where the above check collapses the expolygon, then there's no room for an inner loop
|
||||
# and we can extract the gap for later processing
|
||||
my $diff = diff_ex(
|
||||
[ map @$_, $expolygon->offset_ex(-0.5*$distance) ],
|
||||
[ map @$_, map $_->offset_ex(+0.5*$distance), @offsets ], # should these be offsetted in a single pass?
|
||||
[ Slic3r::Geometry::Clipper::offset([map @$_, @offsets], +0.5*$distance) ],
|
||||
);
|
||||
push @gaps, grep $_->area >= $gap_area_threshold, @$diff;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user