@@ -41,6 +41,24 @@ suite.addBatch({
4141 } ,
4242 "handles overlapping upper and lower hulls" : function ( h ) {
4343 assert . deepEqual ( h ( [ [ 0 , - 10 ] , [ 0 , 10 ] , [ 0 , 0 ] , [ 10 , 0 ] , [ - 10 , 0 ] ] ) , [ [ 10 , 0 ] , [ 0 , - 10 ] , [ - 10 , 0 ] , [ 0 , 10 ] ] ) ;
44+ } ,
45+
46+ // Cases below taken from http://uva.onlinejudge.org/external/6/681.html
47+
48+ "for a complex 15-point polygon" : function ( h ) {
49+ var poly = [ [ 30 , 30 ] , [ 50 , 60 ] , [ 60 , 20 ] , [ 70 , 45 ] , [ 86 , 39 ] , [ 112 , 60 ] , [ 200 , 113 ] , [ 250 , 50 ] , [ 300 , 200 ] , [ 130 , 240 ] , [ 76 , 150 ] , [ 47 , 76 ] , [ 36 , 40 ] , [ 33 , 35 ] , [ 30 , 30 ] ] ;
50+ var expectedHull = [ [ 300 , 200 ] , [ 250 , 50 ] , [ 60 , 20 ] , [ 30 , 30 ] , [ 47 , 76 ] , [ 76 , 150 ] , [ 130 , 240 ] ] ;
51+ assert . deepEqual ( h ( poly ) , expectedHull ) ;
52+ } ,
53+ "for a complex 12-point polygon" : function ( h ) {
54+ var poly = [ [ 50 , 60 ] , [ 60 , 20 ] , [ 70 , 45 ] , [ 100 , 70 ] , [ 125 , 90 ] , [ 200 , 113 ] , [ 250 , 140 ] , [ 180 , 170 ] , [ 105 , 140 ] , [ 79 , 140 ] , [ 60 , 85 ] , [ 50 , 60 ] ] ;
55+ var expectedHull = [ [ 250 , 140 ] , [ 60 , 20 ] , [ 50 , 60 ] , [ 79 , 140 ] , [ 180 , 170 ] ] ;
56+ assert . deepEqual ( h ( poly ) , expectedHull ) ;
57+ } ,
58+ "for a complex 6-point polygon" : function ( h ) {
59+ var poly = [ [ 60 , 20 ] , [ 250 , 140 ] , [ 180 , 170 ] , [ 79 , 140 ] , [ 50 , 60 ] , [ 60 , 20 ] ] ;
60+ var expectedHull = [ [ 250 , 140 ] , [ 60 , 20 ] , [ 50 , 60 ] , [ 79 , 140 ] , [ 180 , 170 ] ] ;
61+ assert . deepEqual ( h ( poly ) , expectedHull ) ;
4462 }
4563 } ,
4664 "the hull layout with custom accessors" : {
0 commit comments