Fix narrow fills growing
This commit is contained in:
parent
d9b82c79da
commit
9713b9f524
2 changed files with 19 additions and 5 deletions
|
@ -13,7 +13,7 @@ use Slic3r::Fill::PlanePath;
|
|||
use Slic3r::Fill::Rectilinear;
|
||||
use Slic3r::ExtrusionPath ':roles';
|
||||
use Slic3r::Geometry qw(X Y PI scale chained_path);
|
||||
use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex offset);
|
||||
use Slic3r::Geometry::Clipper qw(union_ex diff diff_ex intersection_ex offset);
|
||||
use Slic3r::Surface ':types';
|
||||
|
||||
|
||||
|
@ -109,19 +109,25 @@ sub make_fill {
|
|||
# any void neighbors
|
||||
my $distance_between_surfaces = $layerm->infill_flow->scaled_spacing;
|
||||
{
|
||||
my $collapsed = diff_ex(
|
||||
my $collapsed = diff(
|
||||
[ map @{$_->expolygon}, @surfaces ],
|
||||
[ offset(
|
||||
[ offset([ map @{$_->expolygon}, @surfaces ], -$distance_between_surfaces/2) ],
|
||||
+$distance_between_surfaces/2
|
||||
) ],
|
||||
1,
|
||||
);
|
||||
push @surfaces, map Slic3r::Surface->new(
|
||||
expolygon => $_,
|
||||
surface_type => S_TYPE_INTERNALSOLID,
|
||||
), @{intersection_ex(
|
||||
[ offset([ map @$_, @$collapsed ], $distance_between_surfaces) ],
|
||||
[ map @{$_->expolygon}, grep $_->surface_type == S_TYPE_INTERNALVOID, @surfaces ],
|
||||
[ offset($collapsed, $distance_between_surfaces) ],
|
||||
[
|
||||
(map @{$_->expolygon}, grep $_->surface_type == S_TYPE_INTERNALVOID, @surfaces),
|
||||
(@$collapsed),
|
||||
],
|
||||
undef,
|
||||
1,
|
||||
)};
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,15 @@ sub diff_ex {
|
|||
}
|
||||
|
||||
sub diff {
|
||||
return [ map @$_, diff_ex(@_) ];
|
||||
my ($subject, $clip, $safety_offset) = @_;
|
||||
|
||||
$clipper->clear;
|
||||
$clipper->add_subject_polygons($subject);
|
||||
$clipper->add_clip_polygons($safety_offset ? safety_offset($clip) : $clip);
|
||||
return [
|
||||
map Slic3r::Polygon->new($_),
|
||||
@{ $clipper->execute(CT_DIFFERENCE, PFT_NONZERO, PFT_NONZERO) },
|
||||
];
|
||||
}
|
||||
|
||||
sub union_ex {
|
||||
|
|
Loading…
Reference in a new issue