mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-03 01:05:14 +08:00
Don't trigger extra perimeters when less than 30% of the upper loops would benefit from it. #2664. Also fixes #2610
This commit is contained in:
parent
7a695a4a2f
commit
45c91b2ae9
@ -398,15 +398,26 @@ sub make_perimeters {
|
|||||||
|
|
||||||
# check whether a portion of the upper slices falls inside the critical area
|
# check whether a portion of the upper slices falls inside the critical area
|
||||||
my $intersection = intersection_ppl(
|
my $intersection = intersection_ppl(
|
||||||
[ map @{$_->expolygon}, @{$upper_layerm->slices} ],
|
[ map $_->p, @{$upper_layerm->slices} ],
|
||||||
$critical_area,
|
$critical_area,
|
||||||
);
|
);
|
||||||
|
|
||||||
# ignore any intersection line that is shorter than three times the critical area depth
|
# only add an additional loop if at least 30% of the slice loop would benefit from it
|
||||||
last if !defined first { $_->length > $critical_area_depth * 3 } @$intersection;
|
my $total_loop_length = sum(map $_->length, map $_->p, @{$upper_layerm->slices}) // 0;
|
||||||
|
my $total_intersection_length = sum(map $_->length, @$intersection) // 0;
|
||||||
|
last unless $total_intersection_length > $total_loop_length*0.3;
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
require "Slic3r/SVG.pm";
|
||||||
|
Slic3r::SVG::output(
|
||||||
|
"extra.svg",
|
||||||
|
no_arrows => 1,
|
||||||
|
expolygons => union_ex($critical_area),
|
||||||
|
polylines => [ map $_->split_at_first_point, map $_->p, @{$upper_layerm->slices} ],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$slice->extra_perimeters($slice->extra_perimeters + 1);
|
$slice->extra_perimeters($slice->extra_perimeters + 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
Slic3r::debugf " adding %d more perimeter(s) at layer %d\n",
|
Slic3r::debugf " adding %d more perimeter(s) at layer %d\n",
|
||||||
$slice->extra_perimeters, $layerm->id
|
$slice->extra_perimeters, $layerm->id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user