66 TestUtil testFramework(
"RACRotation",
"convertToRAC", __FILE__, __LINE__ );
69 double GPSAlt = 26000000;
71 Triple SVPos( GPSAlt, 0, 0);
72 Triple SVVel( 0, 0, 4000 );
76 XYZ =
Triple( 1.0, 1.0, 1.0);
80 failMesg =
"Was the X value rotated properly?";
81 testFramework.
assert(1 == rotatedXYZ[0], failMesg, __LINE__);
83 failMesg =
"Was the Y value rotated properly?";
84 testFramework.
assert(1 == rotatedXYZ[1], failMesg, __LINE__);
86 failMesg =
"Was the Z value rotated properly?";
87 testFramework.
assert(-1 == rotatedXYZ[2], failMesg, __LINE__);
90 XYZ =
Triple( -1.0, -1.0, -1.0);
93 failMesg =
"Was the X value rotated properly?";
94 testFramework.
assert(-1 == rotatedXYZ[0], failMesg, __LINE__);
96 failMesg =
"Was the Y value rotated properly?";
97 testFramework.
assert(-1 == rotatedXYZ[1], failMesg, __LINE__);
99 failMesg =
"Was the Z value rotated properly?";
100 testFramework.
assert(1 == rotatedXYZ[2], failMesg, __LINE__);
103 XYZ =
Triple( 0.0, 0.0, -1.0);
106 failMesg =
"Was the X value rotated properly?";
107 testFramework.
assert(0 == rotatedXYZ[0], failMesg, __LINE__);
109 failMesg =
"Was the Y value rotated properly?";
110 testFramework.
assert(-1 == rotatedXYZ[1], failMesg, __LINE__);
112 failMesg =
"Was the Z value rotated properly?";
113 testFramework.
assert(0 == rotatedXYZ[2], failMesg, __LINE__);
116 XYZ =
Triple( 0.0, -1.0, 0.0);
119 failMesg =
"Was the X value rotated properly?";
120 testFramework.
assert(0 == rotatedXYZ[0], failMesg, __LINE__);
122 failMesg =
"Was the Y value rotated properly?";
123 testFramework.
assert(0 == rotatedXYZ[1], failMesg, __LINE__);
125 failMesg =
"Was the Z value rotated properly?";
126 testFramework.
assert(1 == rotatedXYZ[2], failMesg, __LINE__);
138 TestUtil testFramework(
"RACRotation",
"convertToRAC", __FILE__, __LINE__ );
139 std::string failMesg;
141 double GPSAlt = 26000000;
143 Triple SVPos2( 0, GPSAlt, 0);
144 Triple SVVel2( 0, 0, -4000 );
149 XYZ =
Triple( 1.0, 1.0, 1.0);
152 failMesg =
"Was the X value rotated properly?";
153 testFramework.
assert(1 == rotatedXYZ[0], failMesg, __LINE__);
155 failMesg =
"Was the Y value rotated properly?";
156 testFramework.
assert(-1 == rotatedXYZ[1], failMesg, __LINE__);
158 failMesg =
"Was the Z value rotated properly?";
159 testFramework.
assert(-1 == rotatedXYZ[2], failMesg, __LINE__);
161 XYZ =
Triple( -1.0, -1.0, -1.0);
164 failMesg =
"Was the X value rotated properly?";
165 testFramework.
assert(-1 == rotatedXYZ[0], failMesg, __LINE__);
167 failMesg =
"Was the Y value rotated properly?";
168 testFramework.
assert(1 == rotatedXYZ[1], failMesg, __LINE__);
170 failMesg =
"Was the Z value rotated properly?";
171 testFramework.
assert(1 == rotatedXYZ[2], failMesg, __LINE__);
173 XYZ =
Triple( 0.0, 0.0, -1.0);
176 failMesg =
"Was the X value rotated properly?";
177 testFramework.
assert(0 == rotatedXYZ[0], failMesg, __LINE__);
179 failMesg =
"Was the Y value rotated properly?";
180 testFramework.
assert(1 == rotatedXYZ[1], failMesg, __LINE__);
182 failMesg =
"Was the Z value rotated properly?";
183 testFramework.
assert(0 == rotatedXYZ[2], failMesg, __LINE__);
185 XYZ =
Triple( 0.0, -1.0, 0.0);
188 failMesg =
"Was the X value rotated properly?";
189 testFramework.
assert(-1 == rotatedXYZ[0], failMesg, __LINE__);
191 failMesg =
"Was the Y value rotated properly?";
192 testFramework.
assert(0 == rotatedXYZ[1], failMesg, __LINE__);
194 failMesg =
"Was the Z value rotated properly?";
195 testFramework.
assert(0 == rotatedXYZ[2], failMesg, __LINE__);
207 TestUtil testFramework(
"RACRotation",
"convertToRAC", __FILE__, __LINE__ );
208 std::string failMesg;
210 double GPSAlt = 26000000;
212 Triple SVPos3( 0, 0, GPSAlt);
213 Triple SVVel3( 0, 4000, 0 );
218 XYZ =
Triple( 1.0, 1.0, 1.0);
221 failMesg =
"Was the X value rotated properly?";
222 testFramework.
assert(1 == rotatedXYZ[0], failMesg, __LINE__);
224 failMesg =
"Was the Y value rotated properly?";
225 testFramework.
assert(1 == rotatedXYZ[1], failMesg, __LINE__);
227 failMesg =
"Was the Z value rotated properly?";
228 testFramework.
assert(-1 == rotatedXYZ[2], failMesg, __LINE__);
230 XYZ =
Triple( -1.0, -1.0, -1.0);
233 failMesg =
"Was the X value rotated properly?";
234 testFramework.
assert(-1 == rotatedXYZ[0], failMesg, __LINE__);
236 failMesg =
"Was the Y value rotated properly?";
237 testFramework.
assert(-1 == rotatedXYZ[1], failMesg, __LINE__);
239 failMesg =
"Was the Z value rotated properly?";
240 testFramework.
assert(1 == rotatedXYZ[2], failMesg, __LINE__);
242 XYZ =
Triple( 0.0, 0.0, -1.0);
245 failMesg =
"Was the X value rotated properly?";
246 testFramework.
assert(-1 == rotatedXYZ[0], failMesg, __LINE__);
248 failMesg =
"Was the Y value rotated properly?";
249 testFramework.
assert(0 == rotatedXYZ[1], failMesg, __LINE__);
251 failMesg =
"Was the Z value rotated properly?";
252 testFramework.
assert(0 == rotatedXYZ[2], failMesg, __LINE__);
254 XYZ =
Triple( 0.0, -1.0, 0.0);
257 failMesg =
"Was the X value rotated properly?";
258 testFramework.
assert(0 == rotatedXYZ[0], failMesg, __LINE__);
260 failMesg =
"Was the Y value rotated properly?";
261 testFramework.
assert(-1 == rotatedXYZ[1], failMesg, __LINE__);
263 failMesg =
"Was the Z value rotated properly?";
264 testFramework.
assert(0 == rotatedXYZ[2], failMesg, __LINE__);
276 TestUtil testFramework(
"RACRotation",
"convertToRAC", __FILE__, __LINE__ );
277 std::string failMesg;
279 double GPSAlt = 26000000;
285 double thetaphi = 45.0 * (
PI / 180.0 );
286 double x4 = GPSAlt *
sin(thetaphi) *
cos(thetaphi);
287 double y4 = GPSAlt *
sin(thetaphi) *
sin(thetaphi);
288 double z4 = GPSAlt *
cos(thetaphi);
289 Triple SVPos4( x4, y4, z4 );
295 double theta = 135.0 * (
PI/180.0);
296 double phi = 45.0 * (
PI/180.0);
297 double xv4 = 4000 *
sin(phi) *
cos(theta);
298 double yv4 = 4000 *
sin(phi) *
sin(theta);
299 double zv4 = 4000 *
cos(phi);
300 Triple SVVel4( xv4, yv4, zv4 );
305 XYZ =
Triple( 1.0, 1.0, 1.0);
308 double x = 1.0 + 1.0/sqrt(2.0);
309 double y = (-2.0+sqrt(2.0))/(2.0*sqrt(3.0));
310 double z = (1.0 - sqrt(2.0))/sqrt(3.0);
312 failMesg =
"Was the X value rotated properly?";
313 testFramework.
assert(fabs(x - rotatedXYZ[0]) < eps, failMesg, __LINE__);
315 failMesg =
"Was the Y value rotated properly?";
316 testFramework.
assert(fabs(
y - rotatedXYZ[1]) < eps, failMesg, __LINE__);
318 failMesg =
"Was the Z value rotated properly?";
319 testFramework.
assert(fabs(z - rotatedXYZ[2]) < eps, failMesg, __LINE__);
321 XYZ =
Triple( -1.0, -1.0, -1.0);
324 x = -1.0 - 1.0/sqrt(2.0);
325 y = -(-2.0+sqrt(2.0))/(2.0*sqrt(3.0));
326 z = -(1.0 - sqrt(2.0))/sqrt(3.0);
328 failMesg =
"Was the X value rotated properly?";
329 testFramework.
assert(fabs(x - rotatedXYZ[0]) < eps, failMesg, __LINE__);
331 failMesg =
"Was the Y value rotated properly?";
332 testFramework.
assert(fabs(
y - rotatedXYZ[1]) < eps, failMesg, __LINE__);
334 failMesg =
"Was the Z value rotated properly?";
335 testFramework.
assert(fabs(z - rotatedXYZ[2]) < eps, failMesg, __LINE__);
337 XYZ =
Triple( 0.0, 0.0, -1.0);
341 y = -sqrt(2.0)/(2.0*sqrt(3.0));
344 failMesg =
"Was the X value rotated properly?";
345 testFramework.
assert(fabs(x - rotatedXYZ[0]) < eps, failMesg, __LINE__);
347 failMesg =
"Was the Y value rotated properly?";
348 testFramework.
assert(fabs(
y - rotatedXYZ[1]) < eps, failMesg, __LINE__);
350 failMesg =
"Was the Z value rotated properly?";
351 testFramework.
assert(fabs(z - rotatedXYZ[2]) < eps, failMesg, __LINE__);
353 XYZ =
Triple( 0.0, -1.0, 0.0);
357 y = -1.0/(2.0*sqrt(3.0));
358 z = sqrt(2.0)/sqrt(3.0);
360 failMesg =
"Was the X value rotated properly?";
361 testFramework.
assert(fabs(x - rotatedXYZ[0]) < eps, failMesg, __LINE__);
363 failMesg =
"Was the Y value rotated properly?";
364 testFramework.
assert(fabs(
y - rotatedXYZ[1]) < eps, failMesg, __LINE__);
366 failMesg =
"Was the Z value rotated properly?";
367 testFramework.
assert(fabs(z - rotatedXYZ[2]) < eps, failMesg, __LINE__);
379 TestUtil testFramework(
"RACRotation",
"convertToRAC", __FILE__, __LINE__ );
380 std::string failMesg;
382 double GPSAlt = 26000000;
386 refPoint.
v =
Triple( 0, 0, 4000 );
397 testPoint.
v =
Triple( 0.0, 0.0, 1.0 );
404 failMesg =
"Were the position values stored properly?";
407 failMesg =
"Were the velocity values stored properly?";
408 testFramework.
assert(
Triple(0,1,0) == rotatedTestPoint.
v, failMesg, __LINE__);
410 failMesg =
"Was the first velocity value stored properly?";
411 testFramework.
assert(0 == rotatedTestPoint.
v[0], failMesg, __LINE__);
413 failMesg =
"Was the second velocity value stored properly?";
414 testFramework.
assert(1 == rotatedTestPoint.
v[1], failMesg, __LINE__);
416 failMesg =
"Was the third velocity value stored properly?";
417 testFramework.
assert(0 == rotatedTestPoint.
v[2], failMesg, __LINE__);
419 failMesg =
"Was the clock bias value stored properly?";
420 testFramework.
assert(0.0 == rotatedTestPoint.
clkbias, failMesg, __LINE__);
422 failMesg =
"Was the clock drift value stored properly?";
423 testFramework.
assert(0.0 == rotatedTestPoint.
clkdrift, failMesg, __LINE__);
425 failMesg =
"Was the relativity correction value stored properly?";
426 testFramework.
assert(0.0 == rotatedTestPoint.
relcorr, failMesg, __LINE__);
430 testPoint.
v =
Triple( 1.0, -1.0, 1.0);
437 failMesg =
"Were the position values stored properly?";
440 failMesg =
"Were the velocity values stored properly?";
441 testFramework.
assert(
Triple(1.0, 1.0, 1.0) == rotatedTestPoint.
v, failMesg, __LINE__);
443 failMesg =
"Was the first velocity value stored properly?";
444 testFramework.
assert(1 == rotatedTestPoint.
v[0], failMesg, __LINE__);
446 failMesg =
"Was the second velocity value stored properly?";
447 testFramework.
assert(1 == rotatedTestPoint.
v[1], failMesg, __LINE__);
449 failMesg =
"Was the third velocity value stored properly?";
450 testFramework.
assert(1 == rotatedTestPoint.
v[2], failMesg, __LINE__);
452 failMesg =
"Was the clock bias value stored properly?";
453 testFramework.
assert(0.0 == rotatedTestPoint.
clkbias, failMesg, __LINE__);
455 failMesg =
"Was the clock drift value stored properly?";
456 testFramework.
assert(0.0 == rotatedTestPoint.
clkdrift, failMesg, __LINE__);
458 failMesg =
"Was the relativity correction value stored properly?";
459 testFramework.
assert(0.0 == rotatedTestPoint.
relcorr, failMesg, __LINE__);
462 XYZ =
Triple( 1.0, 1.0, -1.0);
465 failMesg =
"Was the Triple converted properly?";
466 testFramework.
assert(
Triple(1,-1,-1) == rotatedXYZ, failMesg, __LINE__);
468 failMesg =
"Was the x value rotated properly?";
469 testFramework.
assert(1 == rotatedXYZ[0], failMesg, __LINE__);
471 failMesg =
"Was the y value rotated properly?";
472 testFramework.
assert(-1 == rotatedXYZ[1], failMesg, __LINE__);
474 failMesg =
"Was the z correction value rotated properly?";
475 testFramework.
assert(-1 == rotatedXYZ[2], failMesg, __LINE__);
485 int check, errorCounter = 0;
489 errorCounter += check;
492 errorCounter += check;
495 errorCounter += check;
498 errorCounter += check;
501 errorCounter += check;
503 std::cout <<
"Total Failures for " << __FILE__ <<
": " << errorCounter << std::endl;