~ubuntu-branches/ubuntu/utopic/slic3r/utopic-proposed

« back to all changes in this revision

Viewing changes to t/angles.t

  • Committer: Package Import Robot
  • Author(s): Alessandro Ranellucci
  • Date: 2014-08-06 11:18:02 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20140806111802-8v6iez93cj6skz5l
Tags: 1.1.7+dfsg-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
use strict;
3
3
use warnings;
4
4
 
5
 
plan tests => 26;
 
5
plan tests => 34;
6
6
 
7
7
BEGIN {
8
8
    use FindBin;
29
29
#==========================================================
30
30
 
31
31
{
 
32
    is line_orientation([ [0, 0],  [10, 0] ]),  (0),      'E orientation';
 
33
    is line_orientation([ [0, 0],  [0, 10] ]),  (PI/2),   'N orientation';
 
34
    is line_orientation([ [10, 0], [0, 0]  ]),  (PI),     'W orientation';
 
35
    is line_orientation([ [0, 10], [0, 0]  ]),  (PI*3/2), 'S orientation';
 
36
    
 
37
    is line_orientation([ [0, 0], [10, 10] ]),  (PI*1/4), 'NE orientation';
 
38
    is line_orientation([ [10, 0], [0, 10] ]),  (PI*3/4), 'NW orientation';
 
39
    is line_orientation([ [10, 10], [0, 0] ]),  (PI*5/4), 'SW orientation';
 
40
    is line_orientation([ [0, 10], [10, 0] ]),  (PI*7/4), 'SE orientation';
 
41
}
 
42
 
 
43
#==========================================================
 
44
 
 
45
{
32
46
    is line_direction([ [0, 0],  [10, 0] ]), (0),      'E direction';
33
47
    is line_direction([ [10, 0], [0, 0]  ]), (0),      'W direction';
34
48
    is line_direction([ [0, 0],  [0, 10] ]), (PI/2),   'N direction';
67
81
    return Slic3r::Line->new(@$l)->atan2_;
68
82
}
69
83
 
 
84
sub line_orientation {
 
85
    my ($l) = @_;
 
86
    return Slic3r::Line->new(@$l)->orientation;
 
87
}
 
88
 
70
89
sub line_direction {
71
90
    my ($l) = @_;
72
91
    return Slic3r::Line->new(@$l)->direction;