A Discrete-Event Network Simulator
API
geo-to-cartesian-test.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014 University of Washington
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Benjamin Cizdziel <ben.cizdziel@gmail.com>
19 */
20
21#include <ns3/test.h>
22#include <ns3/log.h>
23#include <ns3/geographic-positions.h>
24
25NS_LOG_COMPONENT_DEFINE ("GeoToCartesianTest");
26
27using namespace ns3;
28
29// 10 meter tolerance for testing, which is very small with respect to ECEF
30// Cartesian coordinates on or above earth's surface
31const double TOLERANCE = 10;
32
33const double XSPHERE_MATLAB[216] = {6371000, 1968747.27116279, -5154247.27116279,
34-5154247.27116279, 1968747.27116279, 6371000, 1968747.27116279, 608376.364418605,
35-1592750, -1592750.00000000, 608376.364418605, 1968747.27116279,
36-5154247.27116279, -1592750, 4169873.63558139, 4169873.63558139,
37-1592750.00000000, -5154247.27116279, -5154247.27116279, -1592750.00000000,
384169873.63558139, 4169873.63558140, -1592750.00000000, -5154247.27116279,
391968747.27116279, 608376.364418605, -1592750.00000000, -1592750.00000000,
40608376.364418604, 1968747.27116279, 6371000, 1968747.27116279, -5154247.27116279,
41-5154247.27116279, 1968747.27116279, 6371000, 6371200, 1968809.07456167,
42-5154409.07456167, -5154409.07456167, 1968809.07456166, 6371200, 1968809.07456167,
43608395.462719168, -1592800, -1592800.00000000, 608395.462719167, 1968809.07456167,
44-5154409.07456167, -1592800, 4170004.53728083, 4170004.53728083,
45-1592800.00000000, -5154409.07456167, -5154409.07456167, -1592800,
464170004.53728083, 4170004.53728083, -1592800.00000000, -5154409.07456167,
471968809.07456166, 608395.462719167, -1592800.00000000, -1592800.00000000,
48608395.462719167, 1968809.07456166, 6371200, 1968809.07456167, -5154409.07456167,
49-5154409.07456167, 1968809.07456166, 6371200, 6371400, 1968870.87796054,
50-5154570.87796054, -5154570.87796054, 1968870.87796054, 6371400, 1968870.87796054,
51608414.561019730, -1592850, -1592850.00000000, 608414.561019730, 1968870.87796054,
52-5154570.87796054, -1592850, 4170135.43898027, 4170135.43898027,
53-1592850.00000000, -5154570.87796054, -5154570.87796054, -1592850.00000000,
544170135.43898027, 4170135.43898027, -1592850.00000000, -5154570.87796054,
551968870.87796054, 608414.561019730, -1592850.00000000, -1592850.00000000,
56608414.561019729, 1968870.87796054, 6371400, 1968870.87796054, -5154570.87796054,
57-5154570.87796054, 1968870.87796054, 6371400, 6371600, 1968932.68135942,
58-5154732.68135941, -5154732.68135942, 1968932.68135941, 6371600,
591968932.68135942, 608433.659320293, -1592900, -1592900.00000000, 608433.659320292,
601968932.68135942, -5154732.68135941, -1592900.00000000, 4170266.34067971,
614170266.34067971, -1592900.00000000, -5154732.68135941, -5154732.68135942,
62-1592900.00000000, 4170266.34067971, 4170266.34067971, -1592900.00000000,
63-5154732.68135942, 1968932.68135941, 608433.659320292, -1592900.00000000,
64-1592900.00000000, 608433.659320292, 1968932.68135941, 6371600, 1968932.68135942,
65-5154732.68135941, -5154732.68135942, 1968932.68135941, 6371600, 6371800,
661968994.48475829, -5154894.48475829, -5154894.48475829, 1968994.48475829,
676371800, 1968994.48475829, 608452.757620855, -1592950, -1592950.00000000,
68608452.757620855, 1968994.48475829, -5154894.48475829, -1592950, 4170397.24237914,
694170397.24237914, -1592950.00000000, -5154894.48475829, -5154894.48475829,
70-1592950.00000000, 4170397.24237914, 4170397.24237915, -1592950.00000000,
71-5154894.48475829, 1968994.48475829, 608452.757620855, -1592950.00000000,
72-1592950.00000000, 608452.757620854, 1968994.48475829, 6371800, 1968994.48475829,
73-5154894.48475829, -5154894.48475829, 1968994.48475829, 6371800, 6372000,
741969056.28815717, -5155056.28815716, -5155056.28815717, 1969056.28815716,
756372000, 1969056.28815717, 608471.855921418, -1593000, -1593000, 608471.855921417,
761969056.28815717, -5155056.28815716, -1593000.00000000, 4170528.14407858,
774170528.14407858, -1593000.00000000, -5155056.28815716, -5155056.28815717,
78-1593000.00000000, 4170528.14407858, 4170528.14407858, -1593000.00000000,
79-5155056.28815717, 1969056.28815716, 608471.855921417, -1593000.00000000,
80-1593000.00000000, 608471.855921417, 1969056.28815716, 6372000, 1969056.28815717,
81-5155056.28815716, -5155056.28815717, 1969056.28815716, 6372000};
82
83const double YSPHERE_MATLAB[216] = {0, 6059181.06531642, 3744779.84235535,
84-3744779.84235535, -6059181.06531642, -1.56044495147356e-09, 0, 1872389.92117767,
851157200.61148054, -1157200.61148054, -1872389.92117767, -4.82204008791920e-10, 0,
86-4901980.45383588, -3029590.53265821, 3029590.53265821, 4901980.45383588,
871.26242648452870e-09, 0, -4901980.45383589, -3029590.53265821, 3029590.53265821,
884901980.45383589, 1.26242648452870e-09, 0, 1872389.92117767, 1157200.61148054,
89-1157200.61148054, -1872389.92117767, -4.82204008791919e-10, 0, 6059181.06531642,
903744779.84235535, -3744779.84235535, -6059181.06531642, -1.56044495147356e-09, 0,
916059371.27661968, 3744897.39940581, -3744897.39940580, -6059371.27661968,
92-1.56049393734552e-09, 0, 1872448.69970290, 1157236.93860694, -1157236.93860694,
93-1872448.69970290, -4.82219146258841e-10, 0, -4902134.33801274, -3029685.63830984,
943029685.63830984, 4902134.33801274, 1.26246611493160e-09, 0, -4902134.33801274,
95-3029685.63830984, 3029685.63830984, 4902134.33801274, 1.26246611493160e-09, 0,
961872448.69970290, 1157236.93860694, -1157236.93860694, -1872448.69970290,
97-4.82219146258841e-10, 0, 6059371.27661968, 3744897.39940581, -3744897.39940580,
98-6059371.27661968, -1.56049393734552e-09, 0, 6059561.48792294, 3745014.95645626,
99-3745014.95645626, -6059561.48792294, -1.56054292321749e-09, 0, 1872507.47822813,
1001157273.26573334, -1157273.26573334, -1872507.47822813, -4.82234283725763e-10, 0,
101-4902288.22218960, -3029780.74396147, 3029780.74396147, 4902288.22218960,
1021.26250574533451e-09, 0, -4902288.22218960, -3029780.74396147, 3029780.74396147,
1034902288.22218960, 1.26250574533451e-09, 0, 1872507.47822813, 1157273.26573334,
104-1157273.26573334, -1872507.47822813, -4.82234283725763e-10, 0, 6059561.48792294,
1053745014.95645626, -3745014.95645626, -6059561.48792294, -1.56054292321749e-09, 0,
1066059751.69922620, 3745132.51350672, -3745132.51350672, -6059751.69922620,
107-1.56059190908946e-09, 0, 1872566.25675336, 1157309.59285974, -1157309.59285974,
108-1872566.25675336, -4.82249421192685e-10, 0, -4902442.10636646, -3029875.84961310,
1093029875.84961310, 4902442.10636646, 1.26254537573741e-09, 0, -4902442.10636646,
110-3029875.84961310, 3029875.84961310, 4902442.10636646, 1.26254537573741e-09, 0,
1111872566.25675336, 1157309.59285974, -1157309.59285974, -1872566.25675336,
112-4.82249421192684e-10, 0, 6059751.69922620, 3745132.51350672, -3745132.51350672,
113-6059751.69922620, -1.56059190908946e-09, 0, 6059941.91052946, 3745250.07055718,
114-3745250.07055718, -6059941.91052946, -1.56064089496142e-09, 0, 1872625.03527859,
1151157345.91998614, -1157345.91998614, -1872625.03527859, -4.82264558659606e-10, 0,
116-4902595.99054332, -3029970.95526473, 3029970.95526473, 4902595.99054332,
1171.26258500614032e-09, 0, -4902595.99054332, -3029970.95526473, 3029970.95526473,
1184902595.99054332, 1.26258500614032e-09, 0, 1872625.03527859, 1157345.91998614,
119-1157345.91998614, -1872625.03527859, -4.82264558659606e-10, 0, 6059941.91052946,
1203745250.07055718, -3745250.07055718, -6059941.91052946, -1.56064089496142e-09, 0,
1216060132.12183272, 3745367.62760764, -3745367.62760764, -6060132.12183272,
122-1.56068988083339e-09, 0, 1872683.81380382, 1157382.24711254, -1157382.24711254,
123-1872683.81380382, -4.82279696126528e-10, 0, -4902749.87472018, -3030066.06091636,
1243030066.06091636, 4902749.87472018, 1.26262463654322e-09, 0, -4902749.87472018,
125-3030066.06091636, 3030066.06091636, 4902749.87472018, 1.26262463654322e-09, 0,
1261872683.81380382, 1157382.24711254, -1157382.24711254, -1872683.81380382,
127-4.82279696126528e-10, 0, 6060132.12183272, 3745367.62760764, -3745367.62760764,
128-6060132.12183272, -1.56068988083339e-09};
129
130const double ZSPHERE_MATLAB[216] = {0, 0, 0, 0, 0, 0, 6059181.06531642,
1316059181.06531642, 6059181.06531642, 6059181.06531642, 6059181.06531642,
1326059181.06531642, 3744779.84235535, 3744779.84235535, 3744779.84235535,
1333744779.84235535, 3744779.84235535, 3744779.84235535, -3744779.84235535,
134-3744779.84235535, -3744779.84235535, -3744779.84235535, -3744779.84235535,
135-3744779.84235535, -6059181.06531642, -6059181.06531642, -6059181.06531642,
136-6059181.06531642, -6059181.06531642, -6059181.06531642, -1.56044495147356e-09,
137-1.56044495147356e-09, -1.56044495147356e-09, -1.56044495147356e-09,
138-1.56044495147356e-09, -1.56044495147356e-09, 0, 0, 0, 0, 0, 0, 6059371.27661968,
1396059371.27661968, 6059371.27661968, 6059371.27661968, 6059371.27661968,
1406059371.27661968, 3744897.39940581, 3744897.39940581, 3744897.39940581,
1413744897.39940581, 3744897.39940581, 3744897.39940581, -3744897.39940580,
142-3744897.39940580, -3744897.39940580, -3744897.39940580, -3744897.39940580,
143-3744897.39940580, -6059371.27661968, -6059371.27661968, -6059371.27661968,
144-6059371.27661968, -6059371.27661968, -6059371.27661968, -1.56049393734552e-09,
145-1.56049393734552e-09, -1.56049393734552e-09, -1.56049393734552e-09,
146-1.56049393734552e-09, -1.56049393734552e-09, 0, 0, 0, 0, 0, 0, 6059561.48792294,
1476059561.48792294, 6059561.48792294, 6059561.48792294, 6059561.48792294,
1486059561.48792294, 3745014.95645626, 3745014.95645626, 3745014.95645626,
1493745014.95645626, 3745014.95645626, 3745014.95645626, -3745014.95645626,
150-3745014.95645626, -3745014.95645626, -3745014.95645626, -3745014.95645626,
151-3745014.95645626, -6059561.48792294, -6059561.48792294, -6059561.48792294,
152-6059561.48792294, -6059561.48792294, -6059561.48792294, -1.56054292321749e-09,
153-1.56054292321749e-09, -1.56054292321749e-09, -1.56054292321749e-09,
154-1.56054292321749e-09, -1.56054292321749e-09, 0, 0, 0, 0, 0, 0, 6059751.69922620,
1556059751.69922620, 6059751.69922620, 6059751.69922620, 6059751.69922620,
1566059751.69922620, 3745132.51350672, 3745132.51350672, 3745132.51350672,
1573745132.51350672, 3745132.51350672, 3745132.51350672, -3745132.51350672,
158-3745132.51350672, -3745132.51350672, -3745132.51350672, -3745132.51350672,
159-3745132.51350672, -6059751.69922620, -6059751.69922620, -6059751.69922620,
160-6059751.69922620, -6059751.69922620, -6059751.69922620, -1.56059190908946e-09,
161-1.56059190908946e-09, -1.56059190908946e-09, -1.56059190908946e-09,
162-1.56059190908946e-09, -1.56059190908946e-09, 0, 0, 0, 0, 0, 0, 6059941.91052946,
1636059941.91052946, 6059941.91052946, 6059941.91052946, 6059941.91052946,
1646059941.91052946, 3745250.07055718, 3745250.07055718, 3745250.07055718,
1653745250.07055718, 3745250.07055718, 3745250.07055718, -3745250.07055718,
166-3745250.07055718, -3745250.07055718, -3745250.07055718, -3745250.07055718,
167-3745250.07055718, -6059941.91052946, -6059941.91052946, -6059941.91052946,
168-6059941.91052946, -6059941.91052946, -6059941.91052946, -1.56064089496142e-09,
169-1.56064089496142e-09, -1.56064089496142e-09, -1.56064089496142e-09,
170-1.56064089496142e-09, -1.56064089496142e-09, 0, 0, 0, 0, 0, 0, 6060132.12183272,
1716060132.12183272, 6060132.12183272, 6060132.12183272, 6060132.12183272,
1726060132.12183272, 3745367.62760764, 3745367.62760764, 3745367.62760764,
1733745367.62760764, 3745367.62760764, 3745367.62760764, -3745367.62760764,
174-3745367.62760764, -3745367.62760764, -3745367.62760764, -3745367.62760764,
175-3745367.62760764, -6060132.12183272, -6060132.12183272, -6060132.12183272,
176-6060132.12183272, -6060132.12183272, -6060132.12183272, -1.56068988083339e-09,
177-1.56068988083339e-09, -1.56068988083339e-09, -1.56068988083339e-09,
178-1.56068988083339e-09, -1.56068988083339e-09};
179
180const double XGRS80_MATLAB[216] = {6378137, 1970952.72545164, -5160021.22545164,
181-5160021.22545164, 1970952.72545164, 6378137, 1976947.14312992, 610910.264208145,
182-1599383.83577310, -1599383.83577310, 610910.264208145, 1976947.14312992,
183-5165998.77753988, -1596381.41518003, 4179380.80394997, 4179380.80394997,
184-1596381.41518003, -5165998.77753988, -5165998.77753988, -1596381.41518003,
1854179380.80394997, 4179380.80394997, -1596381.41518003, -5165998.77753988,
1861976947.14312991, 610910.264208145, -1599383.83577310, -1599383.83577310,
187610910.264208145, 1976947.14312991, 6378137, 1970952.72545164, -5160021.22545164,
188-5160021.22545164, 1970952.72545164, 6378137, 6378337, 1971014.52885052,
189-5160183.02885052, -5160183.02885052, 1971014.52885052, 6378337, 1977008.94652879,
190610929.362508708, -1599433.83577310, -1599433.83577310, 610929.362508708,
1911977008.94652879, -5166160.58093876, -1596431.41518003, 4179511.70564940,
1924179511.70564940, -1596431.41518003, -5166160.58093876, -5166160.58093876,
193-1596431.41518003, 4179511.70564940, 4179511.70564940, -1596431.41518003,
194-5166160.58093876, 1977008.94652879, 610929.362508708, -1599433.83577310,
195-1599433.83577310, 610929.362508707, 1977008.94652879, 6378337, 1971014.52885052,
196-5160183.02885052, -5160183.02885052, 1971014.52885052, 6378337, 6378537,
1971971076.33224939, -5160344.83224939, -5160344.83224940, 1971076.33224939,
1986378537, 1977070.74992767, 610948.460809271, -1599483.83577310, -1599483.83577310,
199610948.460809270, 1977070.74992767, -5166322.38433763, -1596481.41518003,
2004179642.60734884, 4179642.60734884, -1596481.41518003, -5166322.38433763,
201-5166322.38433763, -1596481.41518003, 4179642.60734884, 4179642.60734884,
202-1596481.41518003, -5166322.38433763, 1977070.74992766, 610948.460809270,
203-1599483.83577310, -1599483.83577310, 610948.460809270, 1977070.74992766,
2046378537, 1971076.33224939, -5160344.83224939, -5160344.83224940, 1971076.33224939,
2056378537, 6378737, 1971138.13564827, -5160506.63564827, -5160506.63564827,
2061971138.13564827, 6378737, 1977132.55332654, 610967.559109833, -1599533.83577310,
207-1599533.83577310, 610967.559109833, 1977132.55332654, -5166484.18773651,
208-1596531.41518003, 4179773.50904828, 4179773.50904828, -1596531.41518003,
209-5166484.18773651, -5166484.18773651, -1596531.41518003, 4179773.50904828,
2104179773.50904828, -1596531.41518003, -5166484.18773651, 1977132.55332654,
211610967.559109833, -1599533.83577310, -1599533.83577310, 610967.559109832,
2121977132.55332654, 6378737, 1971138.13564827, -5160506.63564827, -5160506.63564827,
2131971138.13564827, 6378737, 6378937, 1971199.93904714, -5160668.43904714,
214-5160668.43904714, 1971199.93904714, 6378937, 1977194.35672542, 610986.657410395,
215-1599583.83577310, -1599583.83577310, 610986.657410395, 1977194.35672542,
216-5166645.99113538, -1596581.41518003, 4179904.41074772, 4179904.41074772,
217-1596581.41518003, -5166645.99113538, -5166645.99113538, -1596581.41518003,
2184179904.41074772, 4179904.41074772, -1596581.41518003, -5166645.99113538,
2191977194.35672541, 610986.657410395, -1599583.83577310, -1599583.83577310,
220610986.657410395, 1977194.35672541, 6378937, 1971199.93904714, -5160668.43904714,
221-5160668.43904714, 1971199.93904714, 6378937, 6379137, 1971261.74244602,
222-5160830.24244602, -5160830.24244602, 1971261.74244602, 6379137, 1977256.16012429,
223611005.755710958, -1599633.83577310, -1599633.83577310, 611005.755710958,
2241977256.16012429, -5166807.79453425, -1596631.41518003, 4180035.31244715,
2254180035.31244715, -1596631.41518003, -5166807.79453425, -5166807.79453426,
226-1596631.41518003, 4180035.31244715, 4180035.31244715, -1596631.41518003,
227-5166807.79453426, 1977256.16012429, 611005.755710958, -1599633.83577310,
228-1599633.83577310, 611005.755710957, 1977256.16012429, 6379137, 1971261.74244602,
229-5160830.24244602, -5160830.24244602, 1971261.74244602, 6379137};
230
231const double YGRS80_MATLAB[216] = {0, 6065968.75567322, 3748974.86570096,
232-3748974.86570096, -6065968.75567322, -1.56219301231466e-09, 0, 1880188.46284479,
2331162020.37529350, -1162020.37529350, -1880188.46284479, -4.84212398183511e-10, 0,
234-4913156.80055210, -3036497.89479889, 3036497.89479889, 4913156.80055210,
2351.26530477346267e-09, 0, -4913156.80055210, -3036497.89479889, 3036497.89479889,
2364913156.80055210, 1.26530477346267e-09, 0, 1880188.46284479, 1162020.37529350,
237-1162020.37529350, -1880188.46284479, -4.84212398183511e-10, 0, 6065968.75567322,
2383748974.86570096, -3748974.86570096, -6065968.75567322, -1.56219301231466e-09, 0,
2396066158.96697648, 3749092.42275142, -3749092.42275142, -6066158.96697648,
240-1.56224199818663e-09, 0, 1880247.24137002, 1162056.70241990, -1162056.70241990,
241-1880247.24137002, -4.84227535650433e-10, 0, -4913310.68472896, -3036593.00045052,
2423036593.00045051, 4913310.68472896, 1.26534440386558e-09, 0, -4913310.68472896,
243-3036593.00045052, 3036593.00045051, 4913310.68472896, 1.26534440386558e-09, 0,
2441880247.24137002, 1162056.70241990, -1162056.70241990, -1880247.24137002,
245-4.84227535650433e-10, 0, 6066158.96697648, 3749092.42275142, -3749092.42275142,
246-6066158.96697648, -1.56224199818663e-09, 0, 6066349.17827974, 3749209.97980188,
247-3749209.97980187, -6066349.17827974, -1.56229098405859e-09, 0, 1880306.01989525,
2481162093.02954630, -1162093.02954630, -1880306.01989525, -4.84242673117355e-10, 0,
249-4913464.56890582, -3036688.10610215, 3036688.10610214, 4913464.56890582,
2501.26538403426848e-09, 0, -4913464.56890582, -3036688.10610215, 3036688.10610215,
2514913464.56890582, 1.26538403426848e-09, 0, 1880306.01989525, 1162093.02954630,
252-1162093.02954630, -1880306.01989525, -4.84242673117354e-10, 0, 6066349.17827974,
2533749209.97980188, -3749209.97980187, -6066349.17827974, -1.56229098405859e-09, 0,
2546066539.38958300, 3749327.53685233, -3749327.53685233, -6066539.38958300,
255-1.56233996993056e-09, 0, 1880364.79842048, 1162129.35667270, -1162129.35667270,
256-1880364.79842048, -4.84257810584276e-10, 0, -4913618.45308268, -3036783.21175378,
2573036783.21175377, 4913618.45308268, 1.26542366467138e-09, 0, -4913618.45308268,
258-3036783.21175378, 3036783.21175377, 4913618.45308268, 1.26542366467138e-09, 0,
2591880364.79842048, 1162129.35667270, -1162129.35667270, -1880364.79842048,
260-4.84257810584276e-10, 0, 6066539.38958300, 3749327.53685233, -3749327.53685233,
261-6066539.38958300, -1.56233996993056e-09, 0, 6066729.60088626, 3749445.09390279,
262-3749445.09390279, -6066729.60088626, -1.56238895580252e-09, 0, 1880423.57694571,
2631162165.68379910, -1162165.68379910, -1880423.57694571, -4.84272948051198e-10, 0,
264-4913772.33725954, -3036878.31740540, 3036878.31740540, 4913772.33725954,
2651.26546329507429e-09, 0, -4913772.33725954, -3036878.31740541, 3036878.31740540,
2664913772.33725954, 1.26546329507429e-09, 0, 1880423.57694571, 1162165.68379910,
267-1162165.68379910, -1880423.57694571, -4.84272948051198e-10, 0, 6066729.60088626,
2683749445.09390279, -3749445.09390279, -6066729.60088626, -1.56238895580252e-09, 0,
2696066919.81218952, 3749562.65095325, -3749562.65095325, -6066919.81218952,
270-1.56243794167449e-09, 0, 1880482.35547094, 1162202.01092550, -1162202.01092550,
271-1880482.35547094, -4.84288085518120e-10, 0, -4913926.22143639, -3036973.42305703,
2723036973.42305703, 4913926.22143639, 1.26550292547719e-09, 0, -4913926.22143639,
273-3036973.42305703, 3036973.42305703, 4913926.22143639, 1.26550292547719e-09, 0,
2741880482.35547094, 1162202.01092550, -1162202.01092550, -1880482.35547094,
275-4.84288085518119e-10, 0, 6066919.81218952, 3749562.65095325, -3749562.65095325,
276-6066919.81218952, -1.56243794167449e-09};
277
278const double ZGRS80_MATLAB[216] = {0, 0, 0, 0, 0, 0, 6043686.27213354,
2796043686.27213354, 6043686.27213354, 6043686.27213354, 6043686.27213354,
2806043686.27213354, 3728191.67572948, 3728191.67572948, 3728191.67572948,
2813728191.67572948, 3728191.67572948, 3728191.67572948, -3728191.67572948,
282-3728191.67572948, -3728191.67572948, -3728191.67572948, -3728191.67572948,
283-3728191.67572948, -6043686.27213354, -6043686.27213354, -6043686.27213354,
284-6043686.27213354, -6043686.27213354, -6043686.27213354, -1.55173509862111e-09,
285-1.55173509862111e-09, -1.55173509862111e-09, -1.55173509862111e-09,
286-1.55173509862111e-09, -1.55173509862111e-09, 0, 0, 0, 0, 0, 0, 6043876.48343680,
2876043876.48343680, 6043876.48343680, 6043876.48343680, 6043876.48343680,
2886043876.48343680, 3728309.23277994, 3728309.23277994, 3728309.23277994,
2893728309.23277994, 3728309.23277994, 3728309.23277994, -3728309.23277994,
290-3728309.23277994, -3728309.23277994, -3728309.23277994, -3728309.23277994,
291-3728309.23277994, -6043876.48343680, -6043876.48343680, -6043876.48343680,
292-6043876.48343680, -6043876.48343680, -6043876.48343680, -1.55178408449307e-09,
293-1.55178408449307e-09, -1.55178408449307e-09, -1.55178408449307e-09,
294-1.55178408449307e-09, -1.55178408449307e-09, 0, 0, 0, 0, 0, 0, 6044066.69474006,
2956044066.69474006, 6044066.69474006, 6044066.69474006, 6044066.69474006,
2966044066.69474006, 3728426.78983040, 3728426.78983040, 3728426.78983040,
2973728426.78983040, 3728426.78983040, 3728426.78983040, -3728426.78983040,
298-3728426.78983040, -3728426.78983040, -3728426.78983040, -3728426.78983040,
299-3728426.78983040, -6044066.69474006, -6044066.69474006, -6044066.69474006,
300-6044066.69474006, -6044066.69474006, -6044066.69474006, -1.55183307036504e-09,
301-1.55183307036504e-09, -1.55183307036504e-09, -1.55183307036504e-09,
302-1.55183307036504e-09, -1.55183307036504e-09, 0, 0, 0, 0, 0, 0, 6044256.90604332,
3036044256.90604332, 6044256.90604332, 6044256.90604332, 6044256.90604332,
3046044256.90604332, 3728544.34688086, 3728544.34688086, 3728544.34688086,
3053728544.34688086, 3728544.34688086, 3728544.34688086, -3728544.34688086,
306-3728544.34688086, -3728544.34688086, -3728544.34688086, -3728544.34688086,
307-3728544.34688086, -6044256.90604332, -6044256.90604332, -6044256.90604332,
308-6044256.90604332, -6044256.90604332, -6044256.90604332, -1.55188205623700e-09,
309-1.55188205623700e-09, -1.55188205623700e-09, -1.55188205623700e-09,
310-1.55188205623700e-09, -1.55188205623700e-09, 0, 0, 0, 0, 0, 0, 6044447.11734658,
3116044447.11734658, 6044447.11734658, 6044447.11734658, 6044447.11734658,
3126044447.11734658, 3728661.90393132, 3728661.90393132, 3728661.90393132,
3133728661.90393132, 3728661.90393132, 3728661.90393132, -3728661.90393132,
314-3728661.90393132, -3728661.90393132, -3728661.90393132, -3728661.90393132,
315-3728661.90393132, -6044447.11734658, -6044447.11734658, -6044447.11734658,
316-6044447.11734658, -6044447.11734658, -6044447.11734658, -1.55193104210897e-09,
317-1.55193104210897e-09, -1.55193104210897e-09, -1.55193104210897e-09,
318-1.55193104210897e-09, -1.55193104210897e-09, 0, 0, 0, 0, 0, 0, 6044637.32864983,
3196044637.32864983, 6044637.32864983, 6044637.32864983, 6044637.32864983,
3206044637.32864983, 3728779.46098178, 3728779.46098178, 3728779.46098178,
3213728779.46098178, 3728779.46098178, 3728779.46098178, -3728779.46098177,
322-3728779.46098177, -3728779.46098177, -3728779.46098177, -3728779.46098177,
323-3728779.46098177, -6044637.32864983, -6044637.32864983, -6044637.32864983,
324-6044637.32864983, -6044637.32864983, -6044637.32864983, -1.55198002798094e-09,
325-1.55198002798094e-09, -1.55198002798094e-09, -1.55198002798094e-09,
326-1.55198002798094e-09, -1.55198002798094e-09};
327
328const double XWGS84_MATLAB[216] = {6378137, 1970952.72545164, -5160021.22545164,
329-5160021.22545164, 1970952.72545164, 6378137, 1976947.14310045, 610910.264199039,
330-1599383.83574926, -1599383.83574926, 610910.264199039, 1976947.14310045,
331-5165998.77751058, -1596381.41517097, 4179380.80392626, 4179380.80392626,
332-1596381.41517097, -5165998.77751058, -5165998.77751058, -1596381.41517097,
3334179380.80392626, 4179380.80392626, -1596381.41517097, -5165998.77751058,
3341976947.14310045, 610910.264199039, -1599383.83574926, -1599383.83574926,
335610910.264199039, 1976947.14310045, 6378137, 1970952.72545164, -5160021.22545164,
336-5160021.22545164, 1970952.72545164, 6378137, 6378337, 1971014.52885052,
337-5160183.02885052, -5160183.02885052, 1971014.52885052, 6378337, 1977008.94649932,
338610929.362499602, -1599433.83574926, -1599433.83574926, 610929.362499601,
3391977008.94649932, -5166160.58090945, -1596431.41517097, 4179511.70562570,
3404179511.70562570, -1596431.41517097, -5166160.58090945, -5166160.58090945,
341-1596431.41517097, 4179511.70562570, 4179511.70562570, -1596431.41517097,
342-5166160.58090945, 1977008.94649932, 610929.362499601, -1599433.83574926,
343-1599433.83574926, 610929.362499601, 1977008.94649932, 6378337, 1971014.52885052,
344-5160183.02885052, -5160183.02885052, 1971014.52885052, 6378337, 6378537,
3451971076.33224939, -5160344.83224939, -5160344.83224940, 1971076.33224939,
3466378537, 1977070.74989820, 610948.460800164, -1599483.83574926, -1599483.83574926,
347610948.460800164, 1977070.74989820, -5166322.38430833, -1596481.41517097,
3484179642.60732513, 4179642.60732514, -1596481.41517097, -5166322.38430833,
349-5166322.38430833, -1596481.41517097, 4179642.60732514, 4179642.60732514,
350-1596481.41517097, -5166322.38430833, 1977070.74989820, 610948.460800164,
351-1599483.83574926, -1599483.83574926, 610948.460800163, 1977070.74989820,
3526378537, 1971076.33224939, -5160344.83224939, -5160344.83224940, 1971076.33224939,
3536378537, 6378737, 1971138.13564827, -5160506.63564827, -5160506.63564827,
3541971138.13564827, 6378737, 1977132.55329707, 610967.559100727, -1599533.83574926,
355-1599533.83574926, 610967.559100726, 1977132.55329707, -5166484.18770720,
356-1596531.41517097, 4179773.50902457, 4179773.50902457, -1596531.41517097,
357-5166484.18770720, -5166484.18770720, -1596531.41517097, 4179773.50902457,
3584179773.50902457, -1596531.41517097, -5166484.18770720, 1977132.55329707,
359610967.559100726, -1599533.83574926, -1599533.83574926, 610967.559100726,
3601977132.55329707, 6378737, 1971138.13564827, -5160506.63564827, -5160506.63564827,
3611971138.13564827, 6378737, 6378937, 1971199.93904714, -5160668.43904714,
362-5160668.43904714, 1971199.93904714, 6378937, 1977194.35669595, 610986.657401289,
363-1599583.83574926, -1599583.83574926, 610986.657401289, 1977194.35669595,
364-5166645.99110608, -1596581.41517097, 4179904.41072401, 4179904.41072401,
365-1596581.41517097, -5166645.99110608, -5166645.99110608, -1596581.41517097,
3664179904.41072401, 4179904.41072401, -1596581.41517097, -5166645.99110608,
3671977194.35669595, 610986.657401289, -1599583.83574926, -1599583.83574926,
368610986.657401288, 1977194.35669595, 6378937, 1971199.93904714, -5160668.43904714,
369-5160668.43904714, 1971199.93904714, 6378937, 6379137, 1971261.74244602,
370-5160830.24244602, -5160830.24244602, 1971261.74244602, 6379137, 1977256.16009482,
371611005.755701852, -1599633.83574926, -1599633.83574926, 611005.755701851,
3721977256.16009482, -5166807.79450495, -1596631.41517097, 4180035.31242345,
3734180035.31242345, -1596631.41517097, -5166807.79450495, -5166807.79450495,
374-1596631.41517097, 4180035.31242345, 4180035.31242345, -1596631.41517097,
375-5166807.79450495, 1977256.16009482, 611005.755701851, -1599633.83574926,
376-1599633.83574926, 611005.755701851, 1977256.16009482, 6379137, 1971261.74244602,
377-5160830.24244602, -5160830.24244602, 1971261.74244602, 6379137};
378
379const double YWGS84_MATLAB[216] = {0, 6065968.75567322, 3748974.86570096,
380-3748974.86570096, -6065968.75567322, -1.56219301231466e-09, 0, 1880188.46281677,
3811162020.37527618, -1162020.37527618, -1880188.46281677, -4.84212398176294e-10, 0,
382-4913156.80052423, -3036497.89478166, 3036497.89478166, 4913156.80052423,
3831.26530477345549e-09, 0, -4913156.80052423, -3036497.89478166, 3036497.89478166,
3844913156.80052423, 1.26530477345549e-09, 0, 1880188.46281677, 1162020.37527618,
385-1162020.37527618, -1880188.46281677, -4.84212398176293e-10, 0, 6065968.75567322,
3863748974.86570096, -3748974.86570096, -6065968.75567322, -1.56219301231466e-09, 0,
3876066158.96697648, 3749092.42275142, -3749092.42275142, -6066158.96697648,
388-1.56224199818663e-09, 0, 1880247.24134200, 1162056.70240258, -1162056.70240258,
389-1880247.24134200, -4.84227535643215e-10, 0, -4913310.68470109, -3036593.00043329,
3903036593.00043329, 4913310.68470109, 1.26534440385840e-09, 0, -4913310.68470109,
391-3036593.00043329, 3036593.00043329, 4913310.68470109, 1.26534440385840e-09, 0,
3921880247.24134200, 1162056.70240258, -1162056.70240258, -1880247.24134200,
393-4.84227535643215e-10, 0, 6066158.96697648, 3749092.42275142, -3749092.42275142,
394-6066158.96697648, -1.56224199818663e-09, 0, 6066349.17827974, 3749209.97980188,
395-3749209.97980187, -6066349.17827974, -1.56229098405859e-09, 0, 1880306.01986723,
3961162093.02952898, -1162093.02952898, -1880306.01986723, -4.84242673110137e-10, 0,
397-4913464.56887795, -3036688.10608492, 3036688.10608492, 4913464.56887795,
3981.26538403426130e-09, 0, -4913464.56887795, -3036688.10608492, 3036688.10608492,
3994913464.56887795, 1.26538403426130e-09, 0, 1880306.01986722, 1162093.02952898,
400-1162093.02952898, -1880306.01986723, -4.84242673110137e-10, 0, 6066349.17827974,
4013749209.97980188, -3749209.97980187, -6066349.17827974, -1.56229098405859e-09, 0,
4026066539.38958300, 3749327.53685233, -3749327.53685233, -6066539.38958300,
403-1.56233996993056e-09, 0, 1880364.79839246, 1162129.35665538, -1162129.35665538,
404-1880364.79839246, -4.84257810577059e-10, 0, -4913618.45305481, -3036783.21173655,
4053036783.21173655, 4913618.45305481, 1.26542366466421e-09, 0, -4913618.45305481,
406-3036783.21173655, 3036783.21173655, 4913618.45305481, 1.26542366466421e-09, 0,
4071880364.79839245, 1162129.35665538, -1162129.35665538, -1880364.79839245,
408-4.84257810577058e-10, 0, 6066539.38958300, 3749327.53685233, -3749327.53685233,
409-6066539.38958300, -1.56233996993056e-09, 0, 6066729.60088626, 3749445.09390279,
410-3749445.09390279, -6066729.60088626, -1.56238895580252e-09, 0, 1880423.57691768,
4111162165.68378178, -1162165.68378178, -1880423.57691768, -4.84272948043980e-10, 0,
412-4913772.33723167, -3036878.31738818, 3036878.31738818, 4913772.33723167,
4131.26546329506711e-09, 0, -4913772.33723167, -3036878.31738818, 3036878.31738818,
4144913772.33723167, 1.26546329506711e-09, 0, 1880423.57691768, 1162165.68378178,
415-1162165.68378178, -1880423.57691768, -4.84272948043980e-10, 0, 6066729.60088626,
4163749445.09390279, -3749445.09390279, -6066729.60088626, -1.56238895580252e-09, 0,
4176066919.81218952, 3749562.65095325, -3749562.65095325, -6066919.81218952,
418-1.56243794167449e-09, 0, 1880482.35544291, 1162202.01090818, -1162202.01090818,
419-1880482.35544291, -4.84288085510902e-10, 0, -4913926.22140853, -3036973.42303981,
4203036973.42303981, 4913926.22140853, 1.26550292547002e-09, 0, -4913926.22140853,
421-3036973.42303981, 3036973.42303981, 4913926.22140853, 1.26550292547002e-09, 0,
4221880482.35544291, 1162202.01090818, -1162202.01090818, -1880482.35544291,
423-4.84288085510902e-10, 0, 6066919.81218952, 3749562.65095325, -3749562.65095325,
424-6066919.81218952, -1.56243794167449e-09};
425
426const double ZWGS84_MATLAB[216] = {0, 0, 0, 0, 0, 0, 6043686.27224277,
4276043686.27224277, 6043686.27224277, 6043686.27224277, 6043686.27224277,
4286043686.27224277, 3728191.67583129, 3728191.67583129, 3728191.67583129,
4293728191.67583129, 3728191.67583129, 3728191.67583129, -3728191.67583129,
430-3728191.67583129, -3728191.67583129, -3728191.67583129, -3728191.67583129,
431-3728191.67583129, -6043686.27224277, -6043686.27224277, -6043686.27224277,
432-6043686.27224277, -6043686.27224277, -6043686.27224277, -1.55173509867228e-09,
433-1.55173509867228e-09, -1.55173509867228e-09, -1.55173509867228e-09,
434-1.55173509867228e-09, -1.55173509867228e-09, 0, 0, 0, 0, 0, 0, 6043876.48354603,
4356043876.48354603, 6043876.48354603, 6043876.48354603, 6043876.48354603,
4366043876.48354603, 3728309.23288175, 3728309.23288175, 3728309.23288175,
4373728309.23288175, 3728309.23288175, 3728309.23288175, -3728309.23288175,
438-3728309.23288175, -3728309.23288175, -3728309.23288175, -3728309.23288175,
439-3728309.23288175, -6043876.48354603, -6043876.48354603, -6043876.48354603,
440-6043876.48354603, -6043876.48354603, -6043876.48354603, -1.55178408454425e-09,
441-1.55178408454425e-09, -1.55178408454425e-09, -1.55178408454425e-09,
442-1.55178408454425e-09, -1.55178408454425e-09, 0, 0, 0, 0, 0, 0, 6044066.69484929,
4436044066.69484929, 6044066.69484929, 6044066.69484929, 6044066.69484929,
4446044066.69484929, 3728426.78993221, 3728426.78993221, 3728426.78993221,
4453728426.78993221, 3728426.78993221, 3728426.78993221, -3728426.78993221,
446-3728426.78993221, -3728426.78993221, -3728426.78993221, -3728426.78993221,
447-3728426.78993221, -6044066.69484929, -6044066.69484929, -6044066.69484929,
448-6044066.69484929, -6044066.69484929, -6044066.69484929, -1.55183307041621e-09,
449-1.55183307041621e-09, -1.55183307041621e-09, -1.55183307041621e-09,
450-1.55183307041621e-09, -1.55183307041621e-09, 0, 0, 0, 0, 0, 0, 6044256.90615255,
4516044256.90615255, 6044256.90615255, 6044256.90615255, 6044256.90615255,
4526044256.90615255, 3728544.34698267, 3728544.34698267, 3728544.34698267,
4533728544.34698267, 3728544.34698267, 3728544.34698267, -3728544.34698267,
454-3728544.34698267, -3728544.34698267, -3728544.34698267, -3728544.34698267,
455-3728544.34698267, -6044256.90615255, -6044256.90615255, -6044256.90615255,
456-6044256.90615255, -6044256.90615255, -6044256.90615255, -1.55188205628818e-09,
457-1.55188205628818e-09, -1.55188205628818e-09, -1.55188205628818e-09,
458-1.55188205628818e-09, -1.55188205628818e-09, 0, 0, 0, 0, 0, 0, 6044447.11745581,
4596044447.11745581, 6044447.11745581, 6044447.11745581, 6044447.11745581,
4606044447.11745581, 3728661.90403313, 3728661.90403313, 3728661.90403313,
4613728661.90403313, 3728661.90403313, 3728661.90403313, -3728661.90403313,
462-3728661.90403313, -3728661.90403313, -3728661.90403313, -3728661.90403313,
463-3728661.90403313, -6044447.11745581, -6044447.11745581, -6044447.11745581,
464-6044447.11745581, -6044447.11745581, -6044447.11745581, -1.55193104216015e-09,
465-1.55193104216015e-09, -1.55193104216015e-09, -1.55193104216015e-09,
466-1.55193104216015e-09, -1.55193104216015e-09, 0, 0, 0, 0, 0, 0, 6044637.32875907,
4676044637.32875907, 6044637.32875907, 6044637.32875907, 6044637.32875907,
4686044637.32875907, 3728779.46108359, 3728779.46108359, 3728779.46108359,
4693728779.46108359, 3728779.46108359, 3728779.46108359, -3728779.46108358,
470-3728779.46108358, -3728779.46108358, -3728779.46108358, -3728779.46108358,
471-3728779.46108358, -6044637.32875907, -6044637.32875907, -6044637.32875907,
472-6044637.32875907, -6044637.32875907, -6044637.32875907, -1.55198002803211e-09,
473-1.55198002803211e-09, -1.55198002803211e-09, -1.55198002803211e-09,
474-1.55198002803211e-09, -1.55198002803211e-09};
475
476
501{
502public:
512 GeoToCartesianTestCase (double latitude,
513 double longitude,
514 double altitude,
516 int i);
517 virtual ~GeoToCartesianTestCase ();
518
519private:
520 virtual void DoRun (void);
521
530 static std::string Name (double latitude,
531 double longitude,
532 double altitude,
534 double m_latitude;
535 double m_longitude;
536 double m_altitude;
538 int m_i;
539};
540
541std::string
543 double longitude,
544 double altitude,
546{
547 std::ostringstream oss;
548 oss << "Geo->Cart: "
549 << "LAT-LON-ALT-SPHEROID = "
550 << latitude << " deg - "
551 << longitude << " deg - "
552 << altitude << " m - ";
553 switch (sphType)
554 {
555 case GeographicPositions::SPHERE:
556 oss << "SPHERE";
557 break;
558 case GeographicPositions::GRS80:
559 oss << "GRS80";
560 break;
561 case GeographicPositions::WGS84:
562 oss << "WGS84";
563 break;
564 };
565
566 return oss.str();
567}
568
570 double longitude,
571 double altitude,
573 int i)
574 : TestCase (Name (latitude, longitude, altitude, sphType)),
575 m_latitude (latitude),
576 m_longitude (longitude),
577 m_altitude (altitude),
578 m_sphType (sphType),
579 m_i (i)
580{
581}
582
584{
585}
586
587void
589{
590 Vector cart = GeographicPositions::GeographicToCartesianCoordinates (m_latitude,
593 m_sphType);
594 if (m_sphType == GeographicPositions::SPHERE)
595 {
598 TOLERANCE,
599 "x coordinate (" << cart.x << ") is incorrect "
600 "for perfect sphere model in iteration " << m_i);
603 TOLERANCE,
604 "y coordinate (" << cart.y << ") is incorrect "
605 "for perfect sphere model in iteration " << m_i);
608 TOLERANCE,
609 "z coordinate (" << cart.z << ") is incorrect "
610 "for perfect sphere model in iteration " << m_i);
611 }
612 else if (m_sphType == GeographicPositions::GRS80)
613 {
616 TOLERANCE,
617 "x coordinate (" << cart.x << ") is incorrect "
618 "for GRS80 model in iteration " << m_i);
621 TOLERANCE,
622 "y coordinate (" << cart.y << ") is incorrect "
623 "for GRS80 model in iteration " << m_i);
626 TOLERANCE,
627 "z coordinate (" << cart.z << ") is incorrect "
628 "for GRS80 model in iteration " << m_i);
629 }
630 else // if m_sphType == GeographicPositions::WGS84
631 {
634 TOLERANCE,
635 "x coordinate (" << cart.x << ") is incorrect "
636 "for WGS84 model in iteration " << m_i);
639 TOLERANCE,
640 "y coordinate (" << cart.y << ") is incorrect "
641 "for WGS84 model in iteration " << m_i);
644 TOLERANCE,
645 "z coordinate (" << cart.z << ") is incorrect "
646 "for WGS84 model in iteration " << m_i);
647 }
648}
649
664{
665public:
675 CartesianToGeoTestCase (double latitude,
676 double longitude,
677 double altitude,
679 int i);
680 virtual ~CartesianToGeoTestCase ();
681
682private:
683 virtual void DoRun (void);
684
693 static std::string Name (double latitude,
694 double longitude,
695 double altitude,
697 double m_latitude;
698 double m_longitude;
699 double m_altitude;
701};
702
703std::string
705 double longitude,
706 double altitude,
708{
709 std::ostringstream oss;
710 oss << "Cart->Geo: "
711 << "LAT-LON-ALT-SPHEROID = "
712 << latitude << " deg - "
713 << longitude << " deg - "
714 << altitude << " m - ";
715 switch (sphType)
716 {
717 case GeographicPositions::SPHERE:
718 oss << "SPHERE";
719 break;
720 case GeographicPositions::GRS80:
721 oss << "GRS80";
722 break;
723 case GeographicPositions::WGS84:
724 oss << "WGS84";
725 break;
726 };
727
728 return oss.str();
729}
730
732 double longitude,
733 double altitude,
735 int i)
736 : TestCase (Name (latitude, longitude, altitude, sphType)),
737 m_latitude (latitude),
738 m_longitude (longitude),
739 m_altitude (altitude),
740 m_sphType (sphType)
741{
742}
743
745{
746}
747
748void
750{
751 Vector cart = GeographicPositions::GeographicToCartesianCoordinates (m_latitude,
754 m_sphType);
755 Vector geo = GeographicPositions::CartesianToGeographicCoordinates (cart, m_sphType);
756
757 // geographic coords are ambiguous due to angular wrapping, convert to
758 // rectangular for comparison
759 Vector geocart = GeographicPositions::GeographicToCartesianCoordinates (geo.x, geo.y, geo.z, m_sphType);
760
762 2.5, // minimum passing tolerance (m)
763 "Double conversion out-of-tolerance: " <<
764 geo << " <> " << Vector ({m_latitude, m_longitude, m_altitude}));
765}
766
774{
775public:
777};
778
780 : TestSuite ("geo-to-cartesian", UNIT)
781{
782 NS_LOG_INFO ("creating GeoToCartesianTestSuite");
783 int i = 0; // iteration number
784 for (double altitude = 0; altitude <= 1000; altitude += 200)
785 {
786 for (double latitude = 0; latitude <= 360; latitude += 72)
787 {
788 for (double longitude = 0; longitude <= 360; longitude += 72)
789 {
790 AddTestCase (new GeoToCartesianTestCase (latitude,
791 longitude,
792 altitude,
793 GeographicPositions::SPHERE,
794 i),
795 TestCase::QUICK);
796 AddTestCase (new CartesianToGeoTestCase (latitude,
797 longitude,
798 altitude,
799 GeographicPositions::SPHERE,
800 i),
801 TestCase::QUICK);
802 ++i;
803 }
804 }
805 }
806 i = 0;
807 for (double altitude = 0; altitude <= 1000; altitude += 200)
808 {
809 for (double latitude = 0; latitude <= 360; latitude += 72)
810 {
811 for (double longitude = 0; longitude <= 360; longitude += 72)
812 {
813 AddTestCase (new GeoToCartesianTestCase (latitude,
814 longitude,
815 altitude,
816 GeographicPositions::GRS80,
817 i),
818 TestCase::QUICK);
819 AddTestCase (new CartesianToGeoTestCase (latitude,
820 longitude,
821 altitude,
822 GeographicPositions::GRS80,
823 i),
824 TestCase::QUICK);
825 ++i;
826 }
827 }
828 }
829 i = 0;
830 for (double altitude = 0; altitude <= 1000; altitude += 200)
831 {
832 for (double latitude = 0; latitude <= 360; latitude += 72)
833 {
834 for (double longitude = 0; longitude <= 360; longitude += 72)
835 {
836 AddTestCase (new GeoToCartesianTestCase (latitude,
837 longitude,
838 altitude,
839 GeographicPositions::WGS84,
840 i),
841 TestCase::QUICK);
842 AddTestCase (new CartesianToGeoTestCase (latitude,
843 longitude,
844 altitude,
845 GeographicPositions::WGS84,
846 i),
847 TestCase::QUICK);
848 ++i;
849 }
850 }
851 }
852}
853
Cartesian to Geo Test Case.
CartesianToGeoTestCase(double latitude, double longitude, double altitude, GeographicPositions::EarthSpheroidType sphType, int i)
Constructor.
virtual void DoRun(void)
Implementation to actually run this TestCase.
double m_longitude
longitude (deg)
static std::string Name(double latitude, double longitude, double altitude, GeographicPositions::EarthSpheroidType sphType)
Name function.
GeographicPositions::EarthSpheroidType m_sphType
spheroid type
double m_latitude
latitude (deg)
Geo To Cartesian Test Case.
double m_longitude
longitude (deg)
virtual void DoRun(void)
Implementation to actually run this TestCase.
GeoToCartesianTestCase(double latitude, double longitude, double altitude, GeographicPositions::EarthSpheroidType sphType, int i)
Constructor.
double m_latitude
latitude (deg)
GeographicPositions::EarthSpheroidType m_sphType
spheroid type
static std::string Name(double latitude, double longitude, double altitude, GeographicPositions::EarthSpheroidType sphType)
Name function.
Geo To Cartesian Test Suite.
EarthSpheroidType
Spheroid model to use for earth: perfect sphere (SPHERE), Geodetic Reference System 1980 (GRS80),...
encapsulates test code
Definition: test.h:994
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
A suite of tests to run.
Definition: test.h:1188
const double ZSPHERE_MATLAB[216]
const double TOLERANCE
const double YGRS80_MATLAB[216]
const double YWGS84_MATLAB[216]
const double ZWGS84_MATLAB[216]
const double YSPHERE_MATLAB[216]
const double XSPHERE_MATLAB[216]
static GeoToCartesianTestSuite g_GeoToCartesianTestSuite
const double XWGS84_MATLAB[216]
const double ZGRS80_MATLAB[216]
const double XGRS80_MATLAB[216]
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Definition: test.h:323
#define NS_TEST_ASSERT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report and abort if not.
Definition: test.h:712
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double CalculateDistance(const Vector3D &a, const Vector3D &b)
Definition: vector.cc:105
static std::string Name(std::string str, uint32_t totalStreamSize, uint32_t sourceWriteSize, uint32_t serverReadSize, uint32_t serverWriteSize, uint32_t sourceReadSize, bool useIpv6)
Definition: tcp-test.cc:166