mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-24 15:13:58 -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
|
@ -18,11 +18,11 @@ sub id {
|
|||
}
|
||||
|
||||
sub cast {
|
||||
my $self = shift;
|
||||
my $class = shift;
|
||||
my ($points) = @_;
|
||||
|
||||
@$points = map { ref $_ eq 'ARRAY' ? Slic3r::Point->cast($_) : $_ } @$points;
|
||||
return __PACKAGE__->new(points => $points);
|
||||
return $class->new(points => $points);
|
||||
}
|
||||
|
||||
sub lines {
|
||||
|
@ -82,4 +82,15 @@ sub make_clockwise {
|
|||
$self->reverse_points if $self->is_counter_clockwise;
|
||||
}
|
||||
|
||||
sub nearest_point_to {
|
||||
my $self = shift;
|
||||
my ($point) = @_;
|
||||
|
||||
# get point as arrayref
|
||||
$point = ref $point eq 'ARRAY' ? $point : $point->p;
|
||||
|
||||
$point = Slic3r::Geometry::nearest_point($point, $self->p);
|
||||
return Slic3r::Point->cast($point);
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue