Grow narrow infill regions into void - to be tested more

This commit is contained in:
Alessandro Ranellucci 2013-03-13 01:03:54 +01:00
parent 6058384978
commit d9b82c79da
3 changed files with 49 additions and 27 deletions

View file

@ -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);
use Slic3r::Geometry::Clipper qw(union_ex diff_ex intersection_ex offset);
use Slic3r::Surface ':types';
@ -98,15 +98,40 @@ sub make_fill {
}
}
# add spacing between surfaces
# we need to detect any narrow surfaces that might collapse
# when adding spacing below
# such narrow surfaces are often generated in sloping walls
# by bridge_over_infill() and combine_infill() as a result of the
# subtraction of the combinable area from the layer infill area,
# which leaves small areas near the perimeters
# we are going to grow such regions by overlapping them with the void (if any)
# TODO: detect and investigate whether there could be narrow regions without
# any void neighbors
my $distance_between_surfaces = $layerm->infill_flow->scaled_spacing;
{
my $distance = $layerm->infill_flow->scaled_spacing / 2;
@surfaces = map $_->offset(-$distance), @surfaces;
my $collapsed = diff_ex(
[ map @{$_->expolygon}, @surfaces ],
[ offset(
[ offset([ map @{$_->expolygon}, @surfaces ], -$distance_between_surfaces/2) ],
+$distance_between_surfaces/2
) ],
);
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 ],
)};
}
# add spacing between surfaces
@surfaces = map $_->offset(-$distance_between_surfaces/2), @surfaces;
my @fills = ();
my @fills_ordering_points = ();
SURFACE: foreach my $surface (@surfaces) {
next if $surface->surface_type == S_TYPE_INTERNALVOID;
my $filler = $Slic3r::Config->fill_pattern;
my $density = $Slic3r::Config->fill_density;
my $flow_spacing = ($surface->surface_type == S_TYPE_TOP)