mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
Optimization of travel paths for perimeters
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user