mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 01:07:57 -06:00
Optimization: cache scaled flow width and spacing
This commit is contained in:
parent
ec0d3987db
commit
bbe0a45b58
9 changed files with 46 additions and 35 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue