Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Ranellucci <aar@cpan.org>2014-08-03 17:03:11 +0400
committerAlessandro Ranellucci <aar@cpan.org>2014-08-03 17:03:47 +0400
commit30fa055995fc0cb63bdd869f291e1873af9a3ad0 (patch)
treef8d86c4b894d41fed06078d5e167e562322ff3a3 /t/angles.t
parente897fbbd51abd54af2b79f904c3becd28fc07dd8 (diff)
Bugfix: medial axis missed some segments. #2144
Diffstat (limited to 't/angles.t')
-rw-r--r--t/angles.t21
1 files changed, 20 insertions, 1 deletions
diff --git a/t/angles.t b/t/angles.t
index 3b5d64e23..1e1a6c9c5 100644
--- a/t/angles.t
+++ b/t/angles.t
@@ -2,7 +2,7 @@ use Test::More;
use strict;
use warnings;
-plan tests => 26;
+plan tests => 34;
BEGIN {
use FindBin;
@@ -29,6 +29,20 @@ use Slic3r::Geometry qw(rad2deg_dir angle3points PI);
#==========================================================
{
+ is line_orientation([ [0, 0], [10, 0] ]), (0), 'E orientation';
+ is line_orientation([ [0, 0], [0, 10] ]), (PI/2), 'N orientation';
+ is line_orientation([ [10, 0], [0, 0] ]), (PI), 'W orientation';
+ is line_orientation([ [0, 10], [0, 0] ]), (PI*3/2), 'S orientation';
+
+ is line_orientation([ [0, 0], [10, 10] ]), (PI*1/4), 'NE orientation';
+ is line_orientation([ [10, 0], [0, 10] ]), (PI*3/4), 'NW orientation';
+ is line_orientation([ [10, 10], [0, 0] ]), (PI*5/4), 'SW orientation';
+ is line_orientation([ [0, 10], [10, 0] ]), (PI*7/4), 'SE orientation';
+}
+
+#==========================================================
+
+{
is line_direction([ [0, 0], [10, 0] ]), (0), 'E direction';
is line_direction([ [10, 0], [0, 0] ]), (0), 'W direction';
is line_direction([ [0, 0], [0, 10] ]), (PI/2), 'N direction';
@@ -67,6 +81,11 @@ sub line_atan {
return Slic3r::Line->new(@$l)->atan2_;
}
+sub line_orientation {
+ my ($l) = @_;
+ return Slic3r::Line->new(@$l)->orientation;
+}
+
sub line_direction {
my ($l) = @_;
return Slic3r::Line->new(@$l)->direction;