Only apply perimeter/infill overlap to the endpoints of rectilinear infill (and do that in a more proper way)

This commit is contained in:
Alessandro Ranellucci 2015-01-13 20:51:31 +01:00
parent 3ee0fc5b1c
commit 04aa240265
5 changed files with 19 additions and 6 deletions

View File

@ -142,7 +142,7 @@ sub make_fill {
# 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 = $infill_flow->scaled_spacing * &Slic3r::INFILL_OVERLAP_OVER_SPACING;
my $distance_between_surfaces = $infill_flow->scaled_spacing;
{
my $collapsed = diff(
[ map @{$_->expolygon}, @surfaces ],

View File

@ -26,9 +26,7 @@ sub fill_surface {
$self->spacing(unscale $distance);
}
# compensate the overlap which is good for rectilinear but harmful for concentric
# where the perimeter/infill spacing should be equal to any other loop spacing
my @loops = my @last = @{offset(\@$expolygon, -&Slic3r::INFILL_OVERLAP_OVER_SPACING * $min_spacing / 2)};
my @loops = my @last = map $_->clone, @$expolygon;
while (@last) {
push @loops, @last = @{offset2(\@last, -($distance + 0.5*$min_spacing), +0.5*$min_spacing)};
}

View File

@ -54,10 +54,21 @@ sub fill_surface {
# the minimum offset for preventing edge lines from being clipped is scaled_epsilon;
# however we use a larger offset to support expolygons with slightly skewed sides and
# not perfectly straight
my @polylines = @{intersection_pl(\@vertical_lines, $expolygon->offset(scale 0.02))};
my @polylines = @{intersection_pl(\@vertical_lines, $expolygon->offset(+scale 0.02))};
my $extra = $self->_min_spacing * &Slic3r::INFILL_OVERLAP_OVER_SPACING;
foreach my $polyline (@polylines) {
my ($first_point, $last_point) = @$polyline[0,-1];
if ($first_point->y > $last_point->y) { #>
($first_point, $last_point) = ($last_point, $first_point);
}
$first_point->set_y($first_point->y - $extra); #--
$last_point->set_y($last_point->y + $extra); #++
}
# connect lines
unless ($params{dont_connect} || !@polylines) { # prevent calling leftmost_point() on empty collections
# offset the expolygon by max(min_spacing/2, extra)
my ($expolygon_off) = @{$expolygon->offset_ex($self->_min_spacing/2)};
my $collection = Slic3r::Polyline::Collection->new(@polylines);
@polylines = ();

View File

@ -1009,7 +1009,7 @@ sub combine_infill {
# Because fill areas for rectilinear and honeycomb are grown
# later to overlap perimeters, we need to counteract that too.
+ (($type == S_TYPE_INTERNALSOLID || $region->config->fill_pattern =~ /(rectilinear|honeycomb)/)
? $layerms[-1]->flow(FLOW_ROLE_SOLID_INFILL)->scaled_width * &Slic3r::INFILL_OVERLAP_OVER_SPACING
? $layerms[-1]->flow(FLOW_ROLE_SOLID_INFILL)->scaled_width
: 0)
)}, @$intersection;

View File

@ -22,6 +22,10 @@
%code{% RETVAL = THIS->x; %};
long y()
%code{% RETVAL = THIS->y; %};
void set_x(long val)
%code{% THIS->x = val; %};
void set_y(long val)
%code{% THIS->y = val; %};
int nearest_point_index(Points points);
Point* nearest_point(Points points)
%code{% RETVAL = new Point(); THIS->nearest_point(points, RETVAL); %};