Changeset 5969 for trunk/psLib/test/astro/tst_psEarthOrientation.c
- Timestamp:
- Jan 12, 2006, 10:40:13 AM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astro/tst_psEarthOrientation.c (modified) (22 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tst_psEarthOrientation.c
r5824 r5969 5 5 * @author d-Rob, MHPCC 6 6 * 7 * @version $Revision: 1.2 4$ $Name: not supported by cvs2svn $8 * @date $Date: 200 5-12-21 06:15:58$7 * @version $Revision: 1.25 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2006-01-12 20:40:13 $ 9 9 * 10 10 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 64 64 static psSphere *obj = NULL; 65 65 static void objSetup(void); 66 static double greatCircle(psSphere *in1, psSphere *in2); 66 67 67 68 static void objSetup(void) … … 80 81 } 81 82 83 //returns the great circle ANGULAR distance between 2 positions (psSphere's) 84 static double greatCircle(psSphere *in1, psSphere *in2) 85 { 86 double r1, r2, d1, d2; 87 r1 = in1->r; 88 r2 = in2->r; 89 d1 = in1->d; 90 d2 = in2->d; 91 double out = 0.0; 92 double c1, c2, cd, s1, s2, sum, ac; 93 c1 = cos(r1); 94 c2 = cos(r2); 95 cd = cos(d1-d2); 96 s1 = sin(r1); 97 s2 = sin(r2); 98 sum = c1*c2*cd + s1*s2; 99 if (sum > 1.0) 100 sum = 1.0 - (sum - 1.0); 101 102 ac = acos(sum); 103 printf("\n c1=%lf, c2=%lf, cd=%lf, s1=%lf, s2=%lf, sum=%.19g, ac=%g\n", c1,c2,cd,s1,s2,sum,ac); 104 // out = acos(cos(r1)*cos(r2)*cos(d1-d2) + sin(r1)*sin(r2)); 105 // if (out != 0.0) printf("\n in greatCircle, out = %lf\n", out); 106 return out; 107 } 108 82 109 psS32 testAberration(void) 83 110 { 84 111 85 112 psSphere *apparent = NULL; 86 psSphere *actual = psSphereAlloc();113 // psSphere *actual = psSphereAlloc(); 87 114 // psSphere *direction = psSphereAlloc(); 88 115 psSphere *empty = NULL; 89 116 90 // actual->r = 0.2; 91 // actual->d = 0.2; 92 // actual->r = DEG_TO_RAD(45.0); 93 // actual->d = DEG_TO_RAD(30.0); 94 actual->r = DEG_TO_RAD(122.9153182445501); 95 actual->d = DEG_TO_RAD(48.562968978679194); 96 // direction->r = 0.2035; 97 // direction->d = 0.2035; 98 // direction->r = DEG_TO_RAD(48.0); 99 // direction->r = DEG_TO_RAD(-157.0); 100 // direction->d = DEG_TO_RAD(20.7072); 117 psCube *actualCube = psCubeAlloc(); 118 // actual->r = DEG_TO_RAD(122.9153182445501); 119 // actual->d = DEG_TO_RAD(48.562968978679194); 120 // actualCube->x = -0.3596195125758298; 121 // actualCube->y = 0.5555613903455866; 122 // actualCube->z = 0.7496834983724809; 123 124 //values from After gravity deflection// 125 actualCube->x = -0.35961949760293604; 126 actualCube->y = 0.5555613950298085; 127 actualCube->z = 0.7496835020836093; 128 psSphere *actual = psCubeToSphere(actualCube); 129 101 130 psCube *cubeDir = psCubeAlloc(); 102 131 cubeDir->x = 5148.713262821658; … … 106 135 cubeDir->y += 248.46429758174693; 107 136 cubeDir->z += 0.09694774143797581; 137 double length = sqrt(cubeDir->x*cubeDir->x+cubeDir->y*cubeDir->y+cubeDir->z*cubeDir->z); 138 cubeDir->x = cubeDir->x/length; 139 cubeDir->y = cubeDir->y/length; 140 cubeDir->z = cubeDir->z/length; 108 141 psSphere *direction = psCubeToSphere(cubeDir); 142 109 143 double speed = sqrt(cubeDir->x*cubeDir->x + cubeDir->y*cubeDir->y + cubeDir->z*cubeDir->z); 110 144 // Speed of light in vacuum (src:NIST) 111 145 double c = 299792458.0; /* m/s */ 112 speed = speed / c; 146 // speed = speed / c; 147 speed = length / c; 113 148 114 149 empty = psAberration(empty, apparent, direction, speed); … … 127 162 apparent = psAberration(apparent, actual, direction, speed); 128 163 129 printf("\nSphere Difference = r,d = %.13g, %.13g\n",130 (actual->r - apparent->r), (actual->d - apparent->d));164 // printf("\nSphere Difference = r,d = %.13g, %.13g\n", 165 // (actual->r - apparent->r), (actual->d - apparent->d)); 131 166 psCube *outCube = psSphereToCube(apparent); 132 167 printf(" -- resultCube = x,y,z = %.13g, %.13g, %.13g -- \n", 133 168 outCube->x, outCube->y, outCube->z); 134 169 //expected cube values 135 170 double x, y, z; 136 171 x = -0.35963388069046304; … … 138 173 z = 0.7497078321908413; 139 174 140 printf(" -- expectedCube = x,y,z = %.13g, %.13g, %.13g -- \n\n", x, y, z); 141 142 if ( fabs(x - outCube->x) > DBL_EPSILON || fabs(y - outCube->y) > DBL_EPSILON || 143 fabs(z - outCube->z) > DBL_EPSILON ) { 175 printf(" -- expectedCube = x,y,z = %.13g, %.13g, %.13g -- \n", x, y, z); 176 printf("Cube Difference = x,y,z = %.13g, %.13g, %.13g \n\n", 177 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 178 psFree(actual); 179 // psFree(actualCube); 180 actualCube->x = x; 181 actualCube->y = y; 182 actualCube->z = z; 183 actual = psCubeToSphere(actualCube); 184 double xxx = greatCircle(actual, apparent); 185 printf(" The great circle angular distance between expected & result = %.13g\n", 186 xxx); 187 188 if ( fabs(x - outCube->x) > FLT_EPSILON || fabs(y - outCube->y) > FLT_EPSILON || 189 fabs(z - outCube->z) > FLT_EPSILON ) { 144 190 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 145 191 "psAberration returned incorrect values.\n"); 146 printf("Cube Difference = x,y,z = %.13g, %.13g, %.13g \n\n", 147 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 192 printf("\nMagnitude of expected change = x,y,z = %.13g, %.13g, %.13g \n", 193 (actualCube->x - x), (actualCube->y - y), (actualCube->z - z) ); 194 printf("Magnitude of actual change = x,y,z = %.13g, %.13g, %.13g \n", 195 (actualCube->x - outCube->x), (actualCube->y - outCube->y), 196 (actualCube->z - outCube->z) ); 197 psFree(actual); 198 // psFree(actualCube); 199 actualCube->x = x; 200 actualCube->y = y; 201 actualCube->z = z; 202 actual = psCubeToSphere(actualCube); 203 x = greatCircle(actual, apparent); 204 printf(" The great circle angular distance between expected & result = %.13g\n", 205 x); 148 206 return 3; 149 207 } 150 208 151 209 psFree(outCube); 210 psFree(actualCube); 152 211 153 212 psFree(cubeDir); … … 162 221 { 163 222 164 psSphere *actual = psSphereAlloc();223 // psSphere *actual = psSphereAlloc(); 165 224 psSphere *apparent = NULL; 166 225 // psSphere *sun = psSphereAlloc(); 167 226 psSphere *empty = NULL; 168 227 169 // sun->r = 0.2; 170 // sun->d = 0.2; 171 // actual->r = 0.61001; 172 // actual->d = 0.01999; 173 actual->r = DEG_TO_RAD(122.9153182445501); 174 actual->d = DEG_TO_RAD(48.562968978679194); 228 psCube *actualCube = psCubeAlloc(); 229 actualCube->x = -0.3596195125758298; 230 actualCube->y = 0.5555613903455866; 231 actualCube->z = 0.7496834983724809; 232 psSphere *actual = psCubeToSphere(actualCube); 175 233 psCube *sunCube = psCubeAlloc(); 176 234 sunCube->x = 1.467797790127511e11; … … 193 251 194 252 apparent = psGravityDeflection(NULL, actual, sun); 253 psSphere *result2 = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN); 254 apparent->r *= -1.0; 255 apparent->d *= -1.0; 195 256 psSphere *result = psSphereSetOffset(actual, apparent, PS_SPHERICAL, PS_RADIAN); 196 197 printf("\nActual r,d = %.13g,%.13g Apparent r,d = %.16g, %.16g \n", 198 actual->r, actual->d, result->r, result->d); 199 printf("Sphere Difference = r,d = %.13g, %.13g\n", 200 (actual->r - result->r), (actual->d - result->d)); 257 // psSphere *result = psSphereGetOffset(apparent, actual, PS_SPHERICAL, PS_RADIAN); 258 printf(" -- actualCube = x,y,z = %.13g, %.13g, %.13g -- \n", 259 actualCube->x, actualCube->y, actualCube->z); 201 260 psCube *outCube = psSphereToCube(result); 202 261 printf(" -- resultCube = x,y,z = %.13g, %.13g, %.13g -- \n", 203 262 outCube->x, outCube->y, outCube->z); 204 psCube *outCube2 = psSphereToCube( actual);205 printf(" -- actualCube= x,y,z = %.13g, %.13g, %.13g -- \n",263 psCube *outCube2 = psSphereToCube(result2); 264 printf(" -- resultCube2= x,y,z = %.13g, %.13g, %.13g -- \n", 206 265 outCube2->x, outCube2->y, outCube2->z); 207 208 266 double x, y, z; 209 267 x = -0.35961949760293604; … … 211 269 z = 0.7496835020836093; 212 270 213 printf(" -- expectedCube = x,y,z = %.13g, %.13g, %.13g -- \n\n", x, y, z); 214 215 if ( fabs(x - outCube->x) > DBL_EPSILON || fabs(y - outCube->y) > DBL_EPSILON || 216 fabs(z - outCube->z) > DBL_EPSILON ) { 217 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 218 "psGravityDeflection returned incorrect values.\n"); 219 printf("Cube Difference = x,y,z = %.13g, %.13g, %.13g \n", 220 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 221 return 1; 222 } 271 printf(" -- expectCube = x,y,z = %.13g, %.13g, %.13g -- \n\n", x, y, z); 272 273 // if ( fabs(x - outCube->x) > DBL_EPSILON || fabs(y - outCube->y) > DBL_EPSILON || 274 // fabs(z - outCube->z) > DBL_EPSILON ) { 275 // psError(PS_ERR_BAD_PARAMETER_VALUE, false, 276 // "psGravityDeflection returned incorrect values.\n"); 277 printf("expect-actual= x,y,z = %.11g, %.11g, %.11g \n", 278 (x - actualCube->x), (y - actualCube->y), (z - actualCube->z) ); 279 printf("result-actual= x,y,z = %.11g, %.11g, %.11g \n", 280 (outCube->x - actualCube->x), (outCube->y - actualCube->y), (outCube->z - actualCube->z) ); 281 printf("expect-result= x,y,z = %.11g, %.11g, %.11g \n", 282 (x - outCube->x), (y - outCube->y), (z - outCube->z) ); 283 // return 1; 284 // } 285 psFree(result2); 286 outCube2->x = x; 287 outCube2->y = y; 288 outCube2->z = z; 289 result2 = psCubeToSphere(outCube2); 290 psFree(result); 291 result = psSphereGetOffset(actual, result2, PS_SPHERICAL, PS_RADIAN); 292 printf("The apparent output sphere = r,d = %.13g, %.13g\n", apparent->r, apparent->d); 293 printf("The expected output sphere = r,d = %.13g, %.13g\n\n", result->r, result->d); 294 psFree(result2); 223 295 224 296 psFree(outCube); 225 297 psFree(outCube2); 226 298 psFree(sunCube); 227 299 psFree(actualCube); 228 300 psFree(result); 229 301 psFree(actual); … … 275 347 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 276 348 " psEOC_PrecessionModel return incorrect values.\n"); 277 printf("\n Precession Model output = x,y,s = %.8g, %.8g, %.8g\n",278 pmodel->x, pmodel->y, pmodel->s);279 printf(" Expected output = x,y,s = %.13g, %.13g, %.13g\n", x, y, s);280 printf(" A difference of: %.13g, %.13g, %.13g\n\n",281 (pmodel->x - x), (pmodel->y - y), (pmodel->s - s) );282 349 return 4; 283 350 } 351 printf("\n Precession Model output = x,y,s = %.8g, %.8g, %.8g\n", 352 pmodel->x, pmodel->y, pmodel->s); 353 printf(" Expected output = x,y,s = %.13g, %.13g, %.13g\n", x, y, s); 354 printf(" A difference of: %.13g, %.13g, %.13g\n\n", 355 (pmodel->x - x), (pmodel->y - y), (pmodel->s - s) ); 284 356 } 285 357 psFree(pmodel); … … 348 420 yy = -0.0287618408203125; 349 421 ss = 0.0; 350 xx = SEC_TO_RAD(xx) * 1e- 6;351 yy = SEC_TO_RAD(yy) * 1e- 6;422 xx = SEC_TO_RAD(xx) * 1e-3; 423 yy = SEC_TO_RAD(yy) * 1e-3; 352 424 // if ( fabs(pcorr->x - xx) > DBL_EPSILON || fabs(pcorr->y - yy) > DBL_EPSILON 353 425 // || fabs(pcorr->s - ss) > DBL_EPSILON) { 354 426 // psError(PS_ERR_BAD_PARAMETER_VALUE, false, 355 427 // " psEOC_PrecessionCorr return incorrect values.\n"); 356 printf(" \nPrecession Correctionoutput (IERSB) = x,y,s = %.13g, %.13g, %.13g\n",428 printf("PrecessionCorr output (IERSB) = x,y,s = %.13g, %.13g, %.13g\n", 357 429 pcorr->x, pcorr->y, pcorr->s); 358 printf("Expected output = x,y,s = %.13g, %.13g, %.13g\n\n", xx, yy, ss);359 //printf(" A difference of: %.13g, %.13g, %.13g\n\n",360 //(pcorr->x - xx), (pcorr->y - yy), (pcorr->s - ss) );430 printf("Expected output = x,y,s = %.13g, %.13g, %.13g\n\n", xx, yy, ss); 431 printf(" A difference of: %.13g, %.13g, %.13g\n\n", 432 (pcorr->x - xx), (pcorr->y - yy), (pcorr->s - ss) ); 361 433 // return 10; 362 434 // } 363 435 } 364 436 437 438 double xCorr, yCorr; 439 xCorr = 3.05224300720406e-10; 440 yCorr = -1.39441339235822e-10; 441 //pcorr is the *expected* output from PrecessionModel// 365 442 pcorr->x = 2.857175590089105e-4; 366 443 pcorr->y = 2.3968739377734732e-5; 367 444 pcorr->s = -1.3970066457904322e-8; 445 pcorr->x += xCorr; 446 pcorr->y += yCorr; 447 psEarthPole *precess = psEOC_PrecessionModel(time2); 448 precess->x += xCorr; 449 precess->y += yCorr; 450 psSphereRot *precessNutInv = psSphereRot_CEOtoGCRS(precess); 451 psSphereRot *precessNut = psSphereRotConjugate(NULL, precessNutInv); 368 452 // pcorr->x += 3.05224300720406e-7; 369 453 // pcorr->y += -1.39441339235822e-7; … … 377 461 printf("\n Error at CEOtoGCRS, output psSphereRot doesn't match expected.\n"); 378 462 } 379 printf(" \nOutput sphere rotation = %.13g,%.13g,%.13g,%.13g\n",463 printf(" Output sphere rotation = %.13g,%.13g,%.13g,%.13g\n", 380 464 pni->q0, pni->q1, pni->q2, pni->q3); 381 465 printf(" Expected sphere rotation = %.13g,%.13g,%.13g\n", q0,q1,q2); 466 printf(" MY sphere rotation = %.13g,%.13g,%.13g\n", 467 precessNutInv->q0, precessNutInv->q1, precessNutInv->q2); 382 468 psCube *objC = psCubeAlloc(); 383 469 // objC->x = -3.5963388069046304; 384 470 // objC->y = 0.5555192509816625; 385 471 // objC->z = 0.7497078321908413; 386 objSetup(); 472 // objSetup(); 473 474 //This is the sphere rotation for the *expected* precession output// 387 475 psSphereRot *pn = psSphereRotConjugate(NULL, pni); 388 // psSphere *sphere = psCubeToSphere(objC); 389 psSphere *sphere = psSphereAlloc(); 390 *sphere = *obj; 391 psFree(obj); 392 psSphere *result = psSphereRotApply(NULL, pn, sphere); 393 objC->x = -0.3598480726985338; 394 objC->y = 0.5555012823608123; 395 objC->z = 0.7496183628158023; 396 psFree(sphere); 397 sphere = psCubeToSphere(objC); 476 477 // psSphere *sphere = psSphereAlloc(); 478 // *sphere = *obj; 479 // psFree(obj); 480 481 //create a psSphere for (from) the start position given in eoc_testing// 482 objC->x = -0.35963388069046304; 483 objC->y = 0.5555192509816625; 484 objC->z = 0.7497078321908413; 485 psSphere *sphere = psCubeToSphere(objC); 486 487 psSphere *expect = psSphereRotApply(NULL, pn, sphere); 488 //expected results below - stored in: sphere // 489 double x,y,z; 490 x = -0.3598480726985338; 491 y = 0.5555012823608123; 492 z = 0.7496183628158023; 493 printf("\n<<Expected out = x,y,z = %.13g, %.13g, %.13g\n", x, y, z); 398 494 psFree(objC); 399 printf("\n Spheres: out = %.13g, %.13g, expect = %.13g, %.13g\n", 400 result->r, result->d, sphere->r, sphere->d); 401 double xx = acos(cos(result->r)*cos(sphere->r)*cos(result->d - sphere->d) + sin(result->r)*sin(sphere->r)); 402 printf("GREAT CIRCLE DIFFERENCE = %.13g \n\n", xx); 495 objC = psSphereToCube(expect); 496 printf("<<Expected out real = x,y,z = %.13g, %.13g, %.13g\n", objC->x, objC->y, objC->z); 497 printf(" Difference = %.13g, %.13g, %.13g\n", objC->x-x, objC->y-y, objC->z-z); 498 x = objC->x; 499 y = objC->y; 500 z = objC->z; 501 psSphere *result = psSphereRotApply(NULL, precessNut, sphere); 502 psFree(objC); 503 objC = psSphereToCube(result); 504 printf("<<Resulting out = x,y,z = %.13g, %.13g, %.13g\n", objC->x, objC->y, objC->z); 505 printf(" Difference = %.13g, %.13g, %.13g\n\n", objC->x-x, objC->y-y, objC->z-z); 506 507 double xx = greatCircle(result, expect); 508 printf("GREAT CIRCLE DIFFERENCE = %.13g \n", xx); 509 psFree(precess); 510 psFree(precessNut); 511 psFree(precessNutInv); 512 psFree(expect); 513 psFree(objC); 403 514 404 515 psFree(sphere); 405 516 psFree(result); 406 517 psFree(pn); 407 // psFree(obj);408 518 psFree(pni); 409 410 519 psFree(pcorr); 411 412 520 psFree(time2); 413 521 if (!p_psEOCFinalize() ) { … … 443 551 } 444 552 553 //Test for IERS bulletin A. 554 double x, y, s; 555 x = -6.454389659777e-07; 556 y = 2.112606414597e-06; 557 s = 0.0; 558 polarMotion = psEOC_GetPolarMotion(in, PS_IERS_A); 559 if (polarMotion == NULL) { 560 psError(PS_ERR_BAD_PARAMETER_NULL, false, 561 "psEOC_GetPolarMotion returned NULL for valid input time.\n"); 562 return 4; 563 } 564 if ( fabs(polarMotion->x - x) > DBL_EPSILON || fabs(polarMotion->y - y) > DBL_EPSILON 565 || fabs(polarMotion->s - s) > DBL_EPSILON) { 566 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 567 "psEOC_GetPolarMotion returned incorrect values.\n"); 568 printf("\n <>PolarMotion output (IERSA) = x,y,s = %.13g, %.13g, %.13g\n", 569 polarMotion->x, polarMotion->y, polarMotion->s); 570 printf("\n <>PolarMotion expected (IERSA) = x,y,s = %.13g, %.13g, %.13g\n", 571 x, y, s); 572 // return 5; 573 } 574 psFree(polarMotion); 575 576 445 577 //Return valid values for correct input time. Test IERS Bulletin B. 446 578 polarMotion = psEOC_GetPolarMotion(in, PS_IERS_B); 447 double x, y, s; 448 x = -6.46014230078e-7; 449 y = 2.11194535765e-6; 450 s = -1.66256670849e-6; 579 x = -6.45381397904e-07; 580 y = 2.112819726698e-06; 581 s = 0.0; 451 582 452 583 if (polarMotion == NULL) { … … 465 596 // return 3; 466 597 } 467 psFree(polarMotion);468 469 //Test for IERS bulletin A.470 x = -6.46028774489e-7;471 y = 2.11172234336e-6;472 s = -1.66257785921e-6;473 polarMotion = psEOC_GetPolarMotion(in, PS_IERS_A);474 if (polarMotion == NULL) {475 psError(PS_ERR_BAD_PARAMETER_NULL, false,476 "psEOC_GetPolarMotion returned NULL for valid input time.\n");477 return 4;478 }479 if ( fabs(polarMotion->x - x) > DBL_EPSILON || fabs(polarMotion->y - y) > DBL_EPSILON480 || fabs(polarMotion->s - s) > DBL_EPSILON) {481 psError(PS_ERR_BAD_PARAMETER_VALUE, false,482 "psEOC_GetPolarMotion returned incorrect values.\n");483 printf("\n <>PolarMotion output (IERSA) = x,y,s = %.13g, %.13g, %.13g\n",484 polarMotion->x, polarMotion->y, polarMotion->s);485 printf("\n <>PolarMotion expected (IERSA) = x,y,s = %.13g, %.13g, %.13g\n",486 x, y, s);487 // return 5;488 }489 490 598 491 599 … … 495 603 return 6; 496 604 } 497 /* 498 double sum = sqrt(nutationCorr->x*nutationCorr->x + nutationCorr->y*nutationCorr->y 499 + nutationCorr->s*nutationCorr->s); 500 nutationCorr->x = nutationCorr->x / sum; 501 nutationCorr->y = nutationCorr->y / sum; 502 nutationCorr->s = nutationCorr->s / sum; 503 */ 504 printf(" -- NutationCorr = x,y,s = %.13g, %.13g, %.13g\n\n", nutationCorr->x, 505 nutationCorr->y, nutationCorr->s); 605 506 606 polarMotion->x += nutationCorr->x; 507 607 polarMotion->y += nutationCorr->y; 508 608 polarMotion->s += nutationCorr->s; 509 x = - 0.13275353774074533;510 y = 0.4359436319739848;511 s = - 4.2376965863576153e-10;609 x = -6.43607313124045e-7; 610 y = 2.11351436973568e-6; 611 s = -7.39617581324646e-12; 512 612 513 613 if ( fabs(polarMotion->x - x) > DBL_EPSILON || fabs(polarMotion->y - y) > DBL_EPSILON … … 525 625 } 526 626 627 psEarthPole *polarTide = psEOC_PolarTideCorr(in); 628 polarMotion->x += polarTide->x; 629 polarMotion->y += polarTide->y; 630 polarMotion->s += polarTide->s; 631 psFree(polarTide); 632 printf("\n PolarMotion + PolarTideCorr out = x,y,s = %.13g, %.13g, %.13g\n", 633 polarMotion->x, polarMotion->y, polarMotion->s); 634 527 635 if (!p_psEOCFinalize() ) { 528 636 psError(PS_ERR_BAD_PARAMETER_VALUE, false, "EOC failed finalization!\n"); … … 602 710 return 3; 603 711 } else { 604 printf("Nutation Correction output = x,y,s = %. 8g, %.8g, %.8g\n\n",712 printf("Nutation Correction output = x,y,s = %.13g, %.13g, %.13g\n\n", 605 713 nute->x, nute->y, nute->s); 606 714 } … … 656 764 objSetup(); 657 765 psSphereRot *earthRot = psSphereRotConjugate(NULL, teoceo); 658 //psSphere *result = psSphereRotApply(NULL, earthRot, obj);659 psSphere *result = psSphereRotApply(NULL, teoceo, obj);766 psSphere *result = psSphereRotApply(NULL, earthRot, obj); 767 // psSphere *result = psSphereRotApply(NULL, teoceo, obj); 660 768 psCube *cube = psSphereToCube(result); 661 769 … … 773 881 psSphere *expected = psCubeToSphere(expect); 774 882 psFree(expect); 775 double d = (6.38e6) *acos(cos(result->r)*cos(expected->r)*cos(result->d-expected->d) + sin(result->r)*sin(expected->r));776 printf(" \n\nGreat circle difference of: %.13g \n", d);883 double d = acos(cos(result->r)*cos(expected->r)*cos(result->d-expected->d) + sin(result->r)*sin(expected->r)); 884 printf("Great circle difference of: %.13g \n", d); 777 885 778 886 psFree(expected); … … 781 889 782 890 783 psSphere *test = psSphereAlloc();784 test->r = 0.0;785 test->d = 0.0;786 test = psSphereRotApply(test, rot, test);787 printf("\n Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d);891 // psSphere *test = psSphereAlloc(); 892 // test->r = 0.0; 893 // test->d = 0.0; 894 // test = psSphereRotApply(test, rot, test); 895 // printf("\n Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d); 788 896 789 897 psFree(precessionNutation); … … 791 899 psFree(cube); 792 900 793 psFree(test);901 // psFree(test); 794 902 psFree(rot); 795 903 psFree(in); … … 875 983 z = 0.7496169753347885; 876 984 printf("\n Cube -expected- has x,y,z = %.13g, %.13g, %.13g \n", x, y, z ); 985 temp->x = x; 986 temp->y = y; 987 temp->z = z; 988 psSphere *sphere = psCubeToSphere(temp); 989 double d = greatCircle(sphere, test); 990 991 printf("Great circle difference of: %.13g \n", d); 992 psFree(sphere); 877 993 878 994 psFree(newRot);
Note:
See TracChangeset
for help on using the changeset viewer.
