Refactor bridge flow to Slic3r::Flow::Bridge class

This commit is contained in:
Alessandro Ranellucci 2013-02-27 10:43:50 +01:00
parent d00c2882c4
commit a9090688f9
6 changed files with 29 additions and 18 deletions

View file

@ -9,8 +9,6 @@ has 'layer_height' => (is => 'ro', default => sub { $Slic3r::Config->layer_
has 'width' => (is => 'rwp', builder => 1);
has 'spacing' => (is => 'lazy');
has 'bridge_width' => (is => 'lazy');
has 'bridge_spacing' => (is => 'lazy');
has 'scaled_width' => (is => 'lazy');
has 'scaled_spacing' => (is => 'lazy');
@ -73,17 +71,6 @@ sub clone {
);
}
sub _build_bridge_width {
my $self = shift;
return sqrt($Slic3r::Config->bridge_flow_ratio * ($self->nozzle_diameter**2));
}
sub _build_bridge_spacing {
my $self = shift;
my $width = $self->bridge_width;
return $width + &Slic3r::OVERLAP_FACTOR * ($width * PI / 4 - $width);
}
sub _build_scaled_width {
my $self = shift;
return scale $self->width;
@ -94,4 +81,22 @@ sub _build_scaled_spacing {
return scale $self->spacing;
}
package Slic3r::Flow::Bridge;
use Moo;
extends 'Slic3r::Flow';
use Slic3r::Geometry qw(PI);
sub _build_width {
my $self = shift;
return sqrt($Slic3r::Config->bridge_flow_ratio * ($self->nozzle_diameter**2));
}
sub _build_spacing {
my $self = shift;
my $width = $self->width;
return $width + &Slic3r::OVERLAP_FACTOR * ($width * PI / 4 - $width);
}
1;