File: 006winding.t

package info (click to toggle)
libmath-clipper-perl 1.23-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 484 kB
  • ctags: 1,094
  • sloc: cpp: 3,448; perl: 131; makefile: 2
file content (27 lines) | stat: -rw-r--r-- 478 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use Math::Clipper ':all';
use Test::More tests => 4;

my $ccw = [
[0,0],
[4,0],
[4,4],
[0,4]
];
my $cw = [
[0,0],
[0,4],
[4,4],
[4,0]
];
my $tricky = [
[0,0],
[40,40],
[40,0],
[0,41]
];

ok(   orientation($ccw)    , 'is_ccw on a counter-clockwise polygon');
ok( ! orientation($cw)     , 'is_ccw on a clockwise polygon');
ok(   orientation($tricky) , 'is_ccw on a bowtie polygon');

is( is_counter_clockwise($ccw), orientation($ccw), 'is_counter_clockwise() === orientation()');