mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 03:07:55 -06:00
Optimization of travel paths for perimeters
This commit is contained in:
parent
03341f3485
commit
0cd10441a1
7 changed files with 113 additions and 46 deletions
31
lib/Slic3r/ExtrusionLoop.pm
Normal file
31
lib/Slic3r/ExtrusionLoop.pm
Normal file
|
@ -0,0 +1,31 @@
|
|||
package Slic3r::ExtrusionLoop;
|
||||
use Moo;
|
||||
|
||||
use XXX;
|
||||
|
||||
extends 'Slic3r::Polyline::Closed';
|
||||
|
||||
sub split_at {
|
||||
my $self = shift;
|
||||
my ($point) = @_;
|
||||
|
||||
$point = Slic3r::Point->cast($point);
|
||||
|
||||
# find index of point
|
||||
my $i = -1;
|
||||
for (my $n = 0; $n <= $#{$self->points}; $n++) {
|
||||
if ($point->id eq $self->points->[$n]->id) {
|
||||
$i = $n;
|
||||
last;
|
||||
}
|
||||
}
|
||||
die "Point not found" if $i == -1;
|
||||
|
||||
my @new_points = ();
|
||||
push @new_points, @{$self->points}[$i .. $#{$self->points}];
|
||||
push @new_points, @{$self->points}[0 .. $i];
|
||||
|
||||
return Slic3r::ExtrusionPath->new(points => [@new_points]);
|
||||
}
|
||||
|
||||
1;
|
Loading…
Add table
Add a link
Reference in a new issue