mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
Optimization: cache scaled flow width and spacing
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
package Slic3r::Flow;
|
||||
use Moo;
|
||||
|
||||
use Slic3r::Geometry qw(PI);
|
||||
use Slic3r::Geometry qw(PI scale);
|
||||
|
||||
has 'nozzle_diameter' => (is => 'ro', required => 1);
|
||||
has 'layer_height' => (is => 'ro', default => sub { $Slic3r::Config->layer_height });
|
||||
|
||||
has 'width' => (is => 'rwp', builder => 1);
|
||||
has 'spacing' => (is => 'lazy');
|
||||
has 'scaled_width' => (is => 'lazy');
|
||||
has 'scaled_spacing' => (is => 'lazy');
|
||||
|
||||
sub BUILD {
|
||||
my $self = shift;
|
||||
@@ -55,4 +57,14 @@ sub _build_spacing {
|
||||
return $self->width - &Slic3r::OVERLAP_FACTOR * ($self->width - $min_flow_spacing);
|
||||
}
|
||||
|
||||
sub _build_scaled_width {
|
||||
my $self = shift;
|
||||
return scale $self->width;
|
||||
}
|
||||
|
||||
sub _build_scaled_spacing {
|
||||
my $self = shift;
|
||||
return scale $self->spacing;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user