Finished new extra perimeters implementation
This commit is contained in:
parent
74e21d7a04
commit
b7945ac790
@ -216,7 +216,7 @@ sub make_perimeters {
|
||||
my @gaps = ();
|
||||
|
||||
# generate perimeters inwards (loop 0 is the external one)
|
||||
my $loop_number = $Slic3r::Config->perimeters + ($surface->additional_inner_perimeters || 0);
|
||||
my $loop_number = $Slic3r::Config->perimeters + ($surface->extra_perimeters || 0);
|
||||
push @perimeters, [] if $loop_number > 0;
|
||||
|
||||
# do one more loop (<= instead of <) so that we can detect gaps even after the desired
|
||||
|
@ -237,11 +237,10 @@ sub make_perimeters {
|
||||
my $overlap = $perimeter_spacing; # one perimeter
|
||||
|
||||
my $diff = diff_ex(
|
||||
[ offset([ map @{$_->expolygon}, @{$upper_layerm->slices} ], -$overlap) ],
|
||||
[ offset([ map @{$_->expolygon}, @{$layerm->slices} ], -($Slic3r::Config->perimeters * $perimeter_spacing)) ],
|
||||
[ offset([ map @{$_->expolygon}, @{$upper_layerm->slices} ], -$overlap) ],
|
||||
);
|
||||
next if !@$diff;
|
||||
|
||||
# if we need more perimeters, $diff should contain a narrow region that we can collapse
|
||||
|
||||
$diff = diff_ex(
|
||||
@ -252,17 +251,17 @@ sub make_perimeters {
|
||||
) ],
|
||||
);
|
||||
next if !@$diff;
|
||||
|
||||
# diff contains the collapsed area
|
||||
|
||||
foreach my $slice (@{$layerm->slices}) {
|
||||
my $hypothetical_perimeter_num = $Slic3r::Config->perimeters + 1;
|
||||
my $extra_perimeters = 0;
|
||||
CYCLE: while (1) {
|
||||
# compute polygons representing the thickness of the hypotetical new internal perimeter
|
||||
# of our slice
|
||||
$extra_perimeters++;
|
||||
my $hypothetical_perimeter = diff_ex(
|
||||
[ offset($slice->expolygon, -($perimeter_spacing * ($hypothetical_perimeter_num-1))) ],
|
||||
[ offset($slice->expolygon, -($perimeter_spacing * $hypothetical_perimeter_num)) ],
|
||||
[ offset($slice->expolygon, -($perimeter_spacing * ($Slic3r::Config->perimeters + $extra_perimeters-1))) ],
|
||||
[ offset($slice->expolygon, -($perimeter_spacing * ($Slic3r::Config->perimeters + $extra_perimeters))) ],
|
||||
);
|
||||
last CYCLE if !@$hypothetical_perimeter; # no extra perimeter is possible
|
||||
|
||||
@ -273,8 +272,7 @@ sub make_perimeters {
|
||||
);
|
||||
last CYCLE if !@$intersection;
|
||||
Slic3r::debugf " adding one more perimeter at layer %d\n", $layer_id;
|
||||
$slice->additional_inner_perimeters(($slice->additional_inner_perimeters || 0) + 1);
|
||||
$hypothetical_perimeter_num++;
|
||||
$slice->extra_perimeters($extra_perimeters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use constant S_EXPOLYGON => 0;
|
||||
use constant S_SURFACE_TYPE => 1;
|
||||
use constant S_DEPTH_LAYERS => 2;
|
||||
use constant S_BRIDGE_ANGLE => 3;
|
||||
use constant S_ADDITIONAL_INNER_PERIMETERS => 4;
|
||||
use constant S_EXTRA_PERIMETERS => 4;
|
||||
|
||||
use constant S_TYPE_TOP => 0;
|
||||
use constant S_TYPE_BOTTOM => 1;
|
||||
@ -24,7 +24,7 @@ sub new {
|
||||
my %args = @_;
|
||||
|
||||
my $self = [
|
||||
map delete $args{$_}, qw(expolygon surface_type depth_layers bridge_angle additional_inner_perimeters),
|
||||
map delete $args{$_}, qw(expolygon surface_type depth_layers bridge_angle extra_perimeters),
|
||||
];
|
||||
$self->[S_DEPTH_LAYERS] //= 1; #/
|
||||
|
||||
@ -36,7 +36,7 @@ sub expolygon { $_[0][S_EXPOLYGON] }
|
||||
sub surface_type { $_[0][S_SURFACE_TYPE] = $_[1] if defined $_[1]; $_[0][S_SURFACE_TYPE] }
|
||||
sub depth_layers { $_[0][S_DEPTH_LAYERS] } # this integer represents the thickness of the surface expressed in layers
|
||||
sub bridge_angle { $_[0][S_BRIDGE_ANGLE] = $_[1] if defined $_[1]; $_[0][S_BRIDGE_ANGLE] }
|
||||
sub additional_inner_perimeters { $_[0][S_ADDITIONAL_INNER_PERIMETERS] = $_[1] if defined $_[1]; $_[0][S_ADDITIONAL_INNER_PERIMETERS] }
|
||||
sub extra_perimeters { $_[0][S_EXTRA_PERIMETERS] = $_[1] if defined $_[1]; $_[0][S_EXTRA_PERIMETERS] }
|
||||
|
||||
# delegate handles
|
||||
sub encloses_point { $_[0]->expolygon->encloses_point }
|
||||
|
Loading…
Reference in New Issue
Block a user