Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2011-10-12 16:54:49 +0400
committerAlessandro Ranellucci <aar@cpan.org>2011-10-12 16:54:49 +0400
commite410410dc72f6c99c6fba2b783ca79442fe78c5a (patch)
treecf4293bd513c08dfd84312046c01469d65bd3212 /lib/Slic3r/ExtrusionPath
parent774717c8bb265e8eb8b1d86f0ea4c612bc0bd680 (diff)
Refactoring. Point objects are now plain arrayrefs. Slicing is 30% faster.
Diffstat (limited to 'lib/Slic3r/ExtrusionPath')
-rw-r--r--lib/Slic3r/ExtrusionPath/Collection.pm10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Slic3r/ExtrusionPath/Collection.pm b/lib/Slic3r/ExtrusionPath/Collection.pm
index 0179d991f..1601bcdbc 100644
--- a/lib/Slic3r/ExtrusionPath/Collection.pm
+++ b/lib/Slic3r/ExtrusionPath/Collection.pm
@@ -18,22 +18,18 @@ sub add {
sub endpoints {
my $self = shift;
- my ($as_arrayref) = @_;
- return map $_->endpoints($as_arrayref), @{$self->paths};
+ return map $_->endpoints, @{$self->paths};
}
sub shortest_path {
my $self = shift;
my ($start_near) = @_;
- # get point as arrayref
- $start_near = $start_near->p if $start_near && ref $start_near ne 'ARRAY';
-
my @paths = ();
my $start_at;
CYCLE: while (@{$self->paths}) {
# find nearest point
- $start_at = Slic3r::Point->cast(Slic3r::Geometry::nearest_point($start_near, [ $self->endpoints(1) ]));
+ $start_at = Slic3r::Point->new(Slic3r::Geometry::nearest_point($start_near, [ $self->endpoints ]));
# loop through paths to find the one that starts or ends at the point found
PATH: for (my $i = 0; $i <= $#{$self->paths}; $i++) {
@@ -45,7 +41,7 @@ sub shortest_path {
} else {
next PATH;
}
- $start_near = $paths[-1]->points->[-1]->p;
+ $start_near = $paths[-1]->points->[-1];
next CYCLE;
}
}