@@ -103,8 +103,8 @@ test("Example 1", () => {
103103 // Step 1
104104 //
105105 // First, the given latitudes and longitudes are converted to n-vectors:
106- const a = fromGeodeticCoordinates (radians (aLat ), radians (aLon ));
107- const b = fromGeodeticCoordinates (radians (bLat ), radians (bLon ));
106+ const a = fromGeodeticCoordinates (radians (aLon ), radians (aLat ));
107+ const b = fromGeodeticCoordinates (radians (bLon ), radians (bLat ));
108108
109109 // Step 2
110110 //
@@ -228,7 +228,7 @@ test("Example 2", () => {
228228 const [c, cDepth] = destination (b , bcE , bDepth , e );
229229
230230 // Use human-friendly outputs:
231- const [lat, lon ] = toGeodeticCoordinates (c );
231+ const [lon, lat ] = toGeodeticCoordinates (c );
232232 const height = - cDepth ;
233233
234234 expect (degrees (lat )).toBeCloseTo (53.32637826433107 , 13 );
@@ -284,7 +284,7 @@ test("Example 3", () => {
284284 // Step 2
285285 //
286286 // Find latitude, longitude and height:
287- const [lat, lon ] = toGeodeticCoordinates (b );
287+ const [lon, lat ] = toGeodeticCoordinates (b );
288288 const height = - bDepth ;
289289
290290 expect (degrees (lat )).toBeCloseTo (5.685075734513181 , 14 );
@@ -327,7 +327,7 @@ test("Example 4", () => {
327327 // SOLUTION:
328328
329329 // Step 1: First, the given latitude and longitude are converted to n-vector:
330- const b = fromGeodeticCoordinates (radians (bLat ), radians (bLon ));
330+ const b = fromGeodeticCoordinates (radians (bLon ), radians (bLat ));
331331
332332 // Step 2: Convert to an ECEF-vector:
333333 const pb = toECEF (b , - bHeight );
@@ -370,8 +370,8 @@ test("Example 5", () => {
370370 // PROBLEM:
371371
372372 // Given two positions A and B as n-vectors:
373- const a = fromGeodeticCoordinates (radians (88 ), radians (0 ));
374- const b = fromGeodeticCoordinates (radians (89 ), radians (- 170 ));
373+ const a = fromGeodeticCoordinates (radians (0 ), radians (88 ));
374+ const b = fromGeodeticCoordinates (radians (- 170 ), radians (89 ));
375375
376376 // Find the surface distance (i.e. great circle distance). The heights of A
377377 // and B are not relevant (i.e. if they do not have zero height, we seek the
@@ -430,8 +430,8 @@ test("Example 6", () => {
430430 const t0 = 10 ,
431431 t1 = 20 ,
432432 ti = 16 ;
433- const pt0 = fromGeodeticCoordinates (radians (89.9 ), radians (- 150 ));
434- const pt1 = fromGeodeticCoordinates (radians (89.9 ), radians (150 ));
433+ const pt0 = fromGeodeticCoordinates (radians (- 150 ), radians (89.9 ));
434+ const pt1 = fromGeodeticCoordinates (radians (150 ), radians (89.9 ));
435435
436436 // Find an interpolated position at time ti, pti. All positions are given as
437437 // n-vectors.
@@ -444,7 +444,7 @@ test("Example 6", () => {
444444 );
445445
446446 // Use human-friendly outputs:
447- const [lat, lon ] = toGeodeticCoordinates (pti );
447+ const [lon, lat ] = toGeodeticCoordinates (pti );
448448
449449 expect (degrees (lat )).toBeCloseTo (89.91282199988446 , 12 );
450450 expect (degrees (lon )).toBeCloseTo (173.4132244463705 , 12 );
@@ -480,9 +480,9 @@ test("Example 7", () => {
480480 // PROBLEM:
481481
482482 // Three positions A, B, and C are given as n-vectors:
483- const a = fromGeodeticCoordinates (radians (90 ), radians (0 ));
484- const b = fromGeodeticCoordinates (radians (60 ), radians (10 ));
485- const c = fromGeodeticCoordinates (radians (50 ), radians (- 20 ));
483+ const a = fromGeodeticCoordinates (radians (0 ), radians (90 ));
484+ const b = fromGeodeticCoordinates (radians (10 ), radians (60 ));
485+ const c = fromGeodeticCoordinates (radians (- 20 ), radians (50 ));
486486
487487 // Find the mean position, M. Note that the calculation is independent of the
488488 // heights/depths of the positions.
@@ -534,7 +534,7 @@ test("Example 8", () => {
534534 // PROBLEM:
535535
536536 // Position A is given as n-vector:
537- const a = fromGeodeticCoordinates (radians (80 ), radians (- 90 ));
537+ const a = fromGeodeticCoordinates (radians (- 90 ), radians (80 ));
538538
539539 // We also have an initial direction of travel given as an azimuth (bearing)
540540 // relative to north (clockwise), and finally the distance to travel along a
@@ -587,7 +587,7 @@ test("Example 8", () => {
587587 );
588588
589589 // Use human-friendly outputs:
590- const [lat, lon ] = toGeodeticCoordinates (b );
590+ const [lon, lat ] = toGeodeticCoordinates (b );
591591
592592 expect (degrees (lat )).toBeCloseTo (79.99154867339445 , 13 );
593593 expect (degrees (lon )).toBeCloseTo (- 90.01769837291397 , 13 );
@@ -633,12 +633,12 @@ test("Example 9", () => {
633633 // the two positions are not antipodal).
634634
635635 // Path A is given by a1 and a2:
636- const a1 = fromGeodeticCoordinates (radians (50 ), radians (180 ));
637- const a2 = fromGeodeticCoordinates (radians (90 ), radians (180 ));
636+ const a1 = fromGeodeticCoordinates (radians (180 ), radians (50 ));
637+ const a2 = fromGeodeticCoordinates (radians (180 ), radians (90 ));
638638
639639 // While path B is given by b1 and b2:
640- const b1 = fromGeodeticCoordinates (radians (60 ), radians (160 ));
641- const b2 = fromGeodeticCoordinates (radians (80 ), radians (- 140 ));
640+ const b1 = fromGeodeticCoordinates (radians (160 ), radians (60 ));
641+ const b2 = fromGeodeticCoordinates (radians (- 140 ), radians (80 ));
642642
643643 // Find the position C where the two paths intersect.
644644
@@ -660,7 +660,7 @@ test("Example 9", () => {
660660 const c = apply ((n ) => Math .sign (dot (cTmp , a1 )) * n , cTmp );
661661
662662 // Use human-friendly outputs:
663- const [lat, lon ] = toGeodeticCoordinates (c );
663+ const [lon, lat ] = toGeodeticCoordinates (c );
664664
665665 expect (degrees (lat )).toBeCloseTo (74.16344802135536 , 16 );
666666 expect (degrees (lon )).toBeCloseTo (180 , 16 );
@@ -701,10 +701,10 @@ test("Example 10", () => {
701701 // Path A is given by the two n-vectors a1 and a2 (as in the previous
702702 // example):
703703 const a1 = fromGeodeticCoordinates (radians (0 ), radians (0 ));
704- const a2 = fromGeodeticCoordinates (radians (10 ), radians (0 ));
704+ const a2 = fromGeodeticCoordinates (radians (0 ), radians (10 ));
705705
706706 // And a position B is given by b:
707- const b = fromGeodeticCoordinates (radians (1 ), radians (0. 1 ));
707+ const b = fromGeodeticCoordinates (radians (0. 1 ), radians (1 ));
708708
709709 // Find the cross track distance between the path A (i.e. the great circle
710710 // through a1 and a2) and the position B (i.e. the shortest distance at the
0 commit comments