mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -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
|
@ -3,4 +3,23 @@ use Moo;
|
|||
|
||||
extends 'Slic3r::Polyline';
|
||||
|
||||
sub clip_end {
|
||||
my $self = shift;
|
||||
my ($distance) = @_;
|
||||
|
||||
while ($distance > 0) {
|
||||
my $last_point = pop @{$self->points};
|
||||
|
||||
my $last_segment_length = $last_point->distance_to($self->points->[-1]);
|
||||
if ($last_segment_length <= $distance) {
|
||||
$distance -= $last_segment_length;
|
||||
next;
|
||||
}
|
||||
|
||||
my $new_point = Slic3r::Geometry::point_along_segment($last_point->p, $self->points->[-1]->p, $distance);
|
||||
push @{$self->points}, Slic3r::Point->cast($new_point);
|
||||
$distance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue