@@ -91,22 +91,25 @@ describe('#Sector', function () {
91
91
} ) ;
92
92
93
93
it ( 'getShell with altitude' , function ( ) {
94
- var sector = new maptalks . Sector ( { x : 0 , y : 0 , z : 100 } , 1000 , 0 , 90 ) ;
94
+ const radius = 1000 , altitude = 100 ;
95
+ const len = Math . sqrt ( radius * radius + altitude * altitude ) ;
96
+ var sector = new maptalks . Sector ( { x : 0 , y : 0 , z : altitude } , radius , 0 , 90 ) ;
95
97
var shell = sector . getShell ( ) ;
96
98
97
99
expect ( shell ) . to . have . length ( sector . options . numberOfShellPoints ) ;
98
100
var num = sector . options . numberOfShellPoints ;
99
101
expect ( shell ) . to . have . length ( num ) ;
100
- expect ( map . computeLength ( shell [ 1 ] , [ 0 , 0 , ] ) ) . to . be . approx ( sector . getRadius ( ) , 1E-5 ) ;
102
+
103
+ expect ( map . computeLength ( shell [ 1 ] , [ 0 , 0 , ] ) ) . to . be . approx ( len , 1E-5 ) ;
101
104
expect ( shell [ 1 ] . x ) . to . be . above ( 0 ) ;
102
105
expect ( shell [ 1 ] . y ) . to . be . eql ( 0 ) ;
103
106
104
- expect ( map . computeLength ( shell [ shell . length - 2 ] , [ 0 , 0 ] ) ) . to . be . approx ( sector . getRadius ( ) , 1E-5 ) ;
107
+ expect ( map . computeLength ( shell [ shell . length - 2 ] , [ 0 , 0 ] ) ) . to . be . approx ( len , 1E-5 ) ;
105
108
expect ( shell [ shell . length - 2 ] . y ) . to . be . above ( 0 ) ;
106
109
expect ( shell [ shell . length - 2 ] . x ) . to . be . approx ( 0 , 1E-3 ) ;
107
110
108
- expect ( shell [ shell . length - 2 ] . z ) . to . be . eql ( 100 ) ;
109
- expect ( shell [ 1 ] . z ) . to . be . eql ( 100 ) ;
111
+ expect ( shell [ shell . length - 2 ] . z ) . to . be . eql ( altitude ) ;
112
+ expect ( shell [ 1 ] . z ) . to . be . eql ( altitude ) ;
110
113
} ) ;
111
114
112
115
describe ( 'geometry fires events' , function ( ) {
0 commit comments