mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-21 12:15:21 +00:00
New Point::projection_onto() methods
This commit is contained in:
@@ -4,7 +4,7 @@ use strict;
|
||||
use warnings;
|
||||
|
||||
use Slic3r::XS;
|
||||
use Test::More tests => 10;
|
||||
use Test::More tests => 13;
|
||||
|
||||
my $point = Slic3r::Point->new(10, 15);
|
||||
is_deeply [ @$point ], [10, 15], 'point roundtrip';
|
||||
@@ -46,4 +46,16 @@ ok !$point->coincides_with($point2), 'coincides_with';
|
||||
ok $p0->ccw($p1, $p2) < 0, 'ccw() does not overflow';
|
||||
}
|
||||
|
||||
{
|
||||
my $point = Slic3r::Point->new(15,15);
|
||||
my $line = Slic3r::Line->new([10,10], [20,10]);
|
||||
is_deeply $point->projection_onto_line($line)->pp, [15,10], 'project_onto_line';
|
||||
|
||||
$point = Slic3r::Point->new(0, 15);
|
||||
is_deeply $point->projection_onto_line($line)->pp, [10,10], 'project_onto_line';
|
||||
|
||||
$point = Slic3r::Point->new(25, 15);
|
||||
is_deeply $point->projection_onto_line($line)->pp, [20,10], 'project_onto_line';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
Reference in New Issue
Block a user