mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-05 23:05:10 +08:00
Fix narrow fills growing
This commit is contained in:
parent
d9b82c79da
commit
9713b9f524
@ -13,7 +13,7 @@ use Slic3r::Fill::PlanePath;
|
|||||||
use Slic3r::Fill::Rectilinear;
|
use Slic3r::Fill::Rectilinear;
|
||||||
use Slic3r::ExtrusionPath ':roles';
|
use Slic3r::ExtrusionPath ':roles';
|
||||||
use Slic3r::Geometry qw(X Y PI scale chained_path);
|
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';
|
use Slic3r::Surface ':types';
|
||||||
|
|
||||||
|
|
||||||
@ -109,19 +109,25 @@ sub make_fill {
|
|||||||
# any void neighbors
|
# any void neighbors
|
||||||
my $distance_between_surfaces = $layerm->infill_flow->scaled_spacing;
|
my $distance_between_surfaces = $layerm->infill_flow->scaled_spacing;
|
||||||
{
|
{
|
||||||
my $collapsed = diff_ex(
|
my $collapsed = diff(
|
||||||
[ map @{$_->expolygon}, @surfaces ],
|
[ map @{$_->expolygon}, @surfaces ],
|
||||||
[ offset(
|
[ offset(
|
||||||
[ offset([ map @{$_->expolygon}, @surfaces ], -$distance_between_surfaces/2) ],
|
[ offset([ map @{$_->expolygon}, @surfaces ], -$distance_between_surfaces/2) ],
|
||||||
+$distance_between_surfaces/2
|
+$distance_between_surfaces/2
|
||||||
) ],
|
) ],
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
push @surfaces, map Slic3r::Surface->new(
|
push @surfaces, map Slic3r::Surface->new(
|
||||||
expolygon => $_,
|
expolygon => $_,
|
||||||
surface_type => S_TYPE_INTERNALSOLID,
|
surface_type => S_TYPE_INTERNALSOLID,
|
||||||
), @{intersection_ex(
|
), @{intersection_ex(
|
||||||
[ offset([ map @$_, @$collapsed ], $distance_between_surfaces) ],
|
[ offset($collapsed, $distance_between_surfaces) ],
|
||||||
[ map @{$_->expolygon}, grep $_->surface_type == S_TYPE_INTERNALVOID, @surfaces ],
|
[
|
||||||
|
(map @{$_->expolygon}, grep $_->surface_type == S_TYPE_INTERNALVOID, @surfaces),
|
||||||
|
(@$collapsed),
|
||||||
|
],
|
||||||
|
undef,
|
||||||
|
1,
|
||||||
)};
|
)};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,15 @@ sub diff_ex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub diff {
|
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 {
|
sub union_ex {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user