Get rid of most calls to $Slic3r::flow

This commit is contained in:
Alessandro Ranellucci 2013-02-18 11:52:47 +01:00
parent 6dc62d3cf2
commit b9c84490b8
3 changed files with 13 additions and 8 deletions

View file

@ -16,6 +16,7 @@ has 'layer' => (
has 'region' => (is => 'ro', required => 1);
has 'perimeter_flow' => (is => 'rw');
has 'infill_flow' => (is => 'rw');
has 'infill_area_threshold' => (is => 'lazy');
has 'overhang_width' => (is => 'lazy');
# collection of spare segments generated by slicing the original geometry;
@ -71,6 +72,11 @@ sub _build_overhang_width {
return scale($self->height * ((cos $threshold_rad) / (sin $threshold_rad)));
}
sub _build_infill_area_threshold {
my $self = shift;
return $self->infill_flow->scaled_spacing ** 2;
}
# build polylines from lines
sub make_surfaces {
my $self = shift;
@ -194,7 +200,7 @@ sub make_perimeters {
# this compensation only works for circular holes, while it would
# overcompensate for hexagons and other shapes having straight edges.
# so we require a minimum number of vertices.
next unless $circumference / @$hole >= 3 * $Slic3r::flow->scaled_width;
next unless $circumference / @$hole >= 3 * $self->perimeter_flow->scaled_width;
# revert the compensation done in make_surfaces() and get the actual radius
# of the hole
@ -411,7 +417,7 @@ sub _add_perimeter {
my $self = shift;
my ($polygon, $role) = @_;
return unless $polygon->is_printable($self->perimeter_flow->width);
return unless $polygon->is_printable($self->perimeter_flow);
push @{ $self->perimeters }, Slic3r::ExtrusionLoop->pack(
polygon => $polygon,
role => ($role // EXTR_ROLE_PERIMETER),