Changeset 2096
- Timestamp:
- Oct 13, 2004, 1:58:20 PM (22 years ago)
- Location:
- trunk/psLib/test/astronomy
- Files:
-
- 5 edited
-
Makefile (modified) (2 diffs)
-
tst_psAstrometry.c (modified) (2 diffs)
-
tst_psAstrometry01.c (modified) (3 diffs)
-
tst_psAstrometry03.c (modified) (1 diff)
-
tst_psCoord.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/Makefile
r2065 r2096 3 3 ## Makefile: test/astronomy 4 4 ## 5 ## $Revision: 1.1 7$ $Name: not supported by cvs2svn $6 ## $Date: 2004-10-1 2 23:22:05$5 ## $Revision: 1.18 $ $Name: not supported by cvs2svn $ 6 ## $Date: 2004-10-13 23:58:20 $ 7 7 ## 8 8 ## Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 28 28 tst_psMetadata_05 \ 29 29 tst_psMetadata_06 \ 30 tst_psCoord \ 30 31 tst_psAstrometry \ 31 32 tst_psAstrometry01 \ -
trunk/psLib/test/astronomy/tst_psAstrometry.c
r2067 r2096 5 5 * @author Robert DeSonia, MHPCC 6 6 * 7 * @version $Revision: 1. 7$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10-13 00:10:50 $7 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-13 23:58:20 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 724 724 psFree(readout); 725 725 psFree(readout2); 726 psFree(image);727 726 728 727 return 0; -
trunk/psLib/test/astronomy/tst_psAstrometry01.c
r2083 r2096 5 5 * @author GLG, MHPCC 6 6 * 7 * @version $Revision: 1. 3$ $Name: not supported by cvs2svn $8 * @date $Date: 2004-10-13 2 1:08:11$7 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $ 8 * @date $Date: 2004-10-13 23:58:20 $ 9 9 * 10 10 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 40 40 #define HEIGHT 3055.0 41 41 #define LAPSERATE 20.0 42 #define NUM_CHIPS 2 43 #define NUM_CELLS 4 42 44 43 #define NUM_READOUTS 2 45 44 #define READOUT_NUM_ROWS 8 46 45 #define READOUT_NUM_COLS 8 46 47 #define CELL_WIDTH READOUT_NUM_COLS 48 #define CELL_HEIGHT READOUT_NUM_ROWS 49 50 #define CELL_GAP 2 51 52 #define NUM_CELLS 4 53 #define CELL_MIN_X 0 54 #define CELL_MAX_X CELL_WIDTH 55 #define CELL_MIN_Y 0 56 #define CELL_MAX_Y CELL_HEIGHT 57 58 #define NUM_CHIPS 2 59 #define CHIP_MIN_X 0 60 #define CHIP_MAX_X ((NUM_CELLS * CELL_WIDTH) + ((NUM_CELLS) * CELL_GAP)) 61 #define CHIP_MIN_Y 0 62 #define CHIP_MAX_Y CELL_HEIGHT 63 64 #define CHIP_WIDTH CHIP_MAX_X 65 #define CHIP_HEIGHT CHIP_MAX_Y 66 #define CHIP_GAP 2 67 68 #define FPA_MIN_X 0 69 #define FPA_MAX_X ((NUM_CHIPS * CHIP_WIDTH) + ((NUM_CHIPS) * CHIP_GAP)) 70 #define FPA_MIN_Y 0 71 #define FPA_MAX_Y CHIP_HEIGHT 72 47 73 #define ROW0 0 48 74 #define COL0 0 49 75 50 int genSystem() 76 static void psPlaneDistortFree(psPlaneDistort *pd) 77 { 78 psFree(pd->x); 79 psFree(pd->y); 80 } 81 82 static void psPlaneTransformFree(psPlaneTransform *pd) 83 { 84 psFree(pd->x); 85 psFree(pd->y); 86 } 87 88 #define PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(NAME) \ 89 {\ 90 NAME = (psPlaneTransform *) psAlloc(sizeof(psPlaneTransform)); \ 91 p_psMemSetDeallocator(NAME, (psFreeFcn) psPlaneTransformFree); \ 92 NAME->x = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD); \ 93 NAME->y = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD); \ 94 NAME->x->coeff[1][0] = 1.0; \ 95 NAME->y->coeff[0][1] = 1.0; \ 96 } 97 98 #define PS_CREATE_4D_IDENTITY_PLANE_DISTORT(NAME) \ 99 {\ 100 NAME = (psPlaneDistort *) psAlloc(sizeof(psPlaneDistort)); \ 101 p_psMemSetDeallocator(NAME, (psFreeFcn) psPlaneDistortFree); \ 102 NAME->x = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD); \ 103 NAME->y = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD); \ 104 NAME->x->coeff[1][0][0][0] = 1.0; \ 105 NAME->y->coeff[0][1][0][0] = 1.0; \ 106 } 107 108 /* 109 This routine will create a system of FPAs/Chips/Cells/Readouts. For 110 simplicity, an FPA is defined as a linear array of chips, and a chip is 111 defined as a linear array of cells, both in the x direction. The transforms 112 between the various layers take into account the cell/chip and the boundaries 113 between each. 114 */ 115 psFPA *genSystem() 51 116 { 52 117 int i; 53 118 int j; 54 psTime* now = psTimeGetTime(PS_TIME_UTC); 55 psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE); 56 psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ, 57 now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY, 58 EXP_TIME, WAVELENGTH, obs); 119 int k; 120 psImage *tmpImage; 121 // psTime* now = psTimeGetTime(PS_TIME_UTC); 122 // psObservatory* obs = psObservatoryAlloc(NAME, LATITUDE, LONGITUDE, HEIGHT, LAPSERATE); 123 // psExposure* exp = psExposureAlloc(RA, DEC, HA, ZD, AZ, 124 // now, ROT_ANGLE, TEMPERATURE, PRESSURE, HUMIDITY, 125 // EXP_TIME, WAVELENGTH, obs); 59 126 // psGrommit *grom = psGrommitAlloc(exp); 60 psFPA *myFPA = psFPAAlloc(NUM_CHIPS, exp);127 psFPA *myFPA = psFPAAlloc(NUM_CHIPS, NULL); 61 128 psChip **chips; 62 129 psCell **cells; 63 64 myFPA->fromTangentPlane = NULL; 65 myFPA->toTangentPlane = NULL; 130 psReadout **readouts; 131 132 // We create the transforms between the FPA and tangent plane. The 133 // transform is a simple identity transform. 134 PS_CREATE_4D_IDENTITY_PLANE_DISTORT(myFPA->fromTangentPlane); 135 PS_CREATE_4D_IDENTITY_PLANE_DISTORT(myFPA->toTangentPlane); 66 136 67 137 chips = (psChip **) myFPA->chips->data; 68 138 for (i=0;i<NUM_CHIPS;i++) { 69 139 chips[i] = psChipAlloc(NUM_CELLS, myFPA); 70 chips[i]->toFPA = NULL; 71 chips[i]->fromFPA = NULL; 140 // We create the transforms between the chip and FPA. The 141 // transform is a simple identity transform. 142 PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(chips[i]->toFPA); 143 chips[i]->toFPA->x->coeff[0][0] = (double) (i * (CHIP_WIDTH + CHIP_GAP)); 144 chips[i]->toFPA->x->coeff[1][1] = 0.0; 145 PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(chips[i]->fromFPA); 146 chips[i]->fromFPA->x->coeff[0][0] = (double) (-i * (CHIP_WIDTH + CHIP_GAP)); 147 chips[i]->fromFPA->x->coeff[1][1] = 0.0; 148 72 149 cells = (psCell **) chips[i]->cells->data; 73 150 74 151 for (j=0;j<NUM_CELLS;j++) { 75 152 cells[j] = psCellAlloc(NUM_READOUTS, chips[i]); 76 cells[j]->toChip = NULL; 77 cells[j]->fromChip = NULL; 78 cells[j]->toFPA = NULL; 79 cells[j]->toTP = NULL; 80 /* 81 readouts = (psReadout **) cells[j]->readouts->data; 82 for (k=0;k<NUM_READOUTS;k++) { 83 tmpImage = psImageAlloc(READOUT_NUM_COLS, READOUT_NUM_ROWS, PS_TYPE_F32); 84 readouts[k] = psReadoutAlloc(COL0, ROW0, tmpImage); 85 } 86 */ 87 } 88 } 89 90 psFree(now); 91 psFree(obs); 92 psFree(exp); 93 chips = (psChip **) myFPA->chips->data; 94 for (i=0;i<NUM_CHIPS;i++) { 95 cells = (psCell **) chips[i]->cells->data; 96 for (j=0;j<NUM_CELLS;j++) { 97 /* 98 readouts = (psReadout **) cells[j]->readouts->data; 99 for (k=0;k<NUM_READOUTS;k++) { 100 psFree(readouts[k]); 101 } 102 */ 103 psFree(cells[j]); 104 } 105 psFree(chips[i]); 106 } 107 psFree(myFPA); 108 return(0); 153 // We create the transforms between the cell and the chip. The 154 // transform is a simple identity transform. 155 PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(cells[j]->toChip); 156 cells[j]->toChip->x->coeff[0][0] = (double) (j * (CELL_WIDTH + CELL_GAP)); 157 cells[j]->toChip->x->coeff[1][1] = 0.0; 158 PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(cells[j]->fromChip); 159 cells[j]->fromChip->x->coeff[0][0] = (double) (-j * (CELL_WIDTH + CELL_GAP)); 160 cells[j]->fromChip->x->coeff[1][1] = 0.0; 161 PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(cells[j]->toFPA); 162 cells[j]->toFPA->x->coeff[0][0] = (double) ((i * (CHIP_WIDTH + CHIP_GAP)) + 163 (j * (CELL_WIDTH + CELL_GAP))); 164 cells[j]->toFPA->x->coeff[1][1] = 0.0; 165 PS_CREATE_2D_IDENTITY_PLANE_TRANSFORM(cells[j]->toTP); 166 cells[j]->toTP->x->coeff[0][0] = cells[j]->toFPA->x->coeff[0][0]; 167 cells[j]->toTP->x->coeff[1][1] = 0.0; 168 169 readouts = (psReadout **) cells[j]->readouts->data; 170 for (k=0;k<NUM_READOUTS;k++) { 171 tmpImage = psImageAlloc(READOUT_NUM_COLS, READOUT_NUM_ROWS, PS_TYPE_F32); 172 for (int row=0;row<READOUT_NUM_ROWS;row++) { 173 for(int col=0;col<READOUT_NUM_COLS;col++) { 174 tmpImage->data.F32[row][col] = (float) ((i * (CHIP_WIDTH + CHIP_GAP)) + 175 (j * (CELL_WIDTH + CELL_GAP))); 176 } 177 } 178 readouts[k] = psReadoutAlloc((j * (CELL_WIDTH + CELL_GAP)), 0, tmpImage); 179 180 } 181 } 182 } 183 184 return(myFPA); 109 185 } 110 186 … … 295 371 } 296 372 373 int test3a( void ) 374 { 375 int x; 376 int y; 377 psPlane fpaCoord; 378 psFPA *myFPA = genSystem(); 379 psCell *myCell = NULL; 380 psPlane chipCoord; 381 psPlane cellCoord; 382 psPlane testCoord; 383 384 int xReadout = 0; 385 int xFPA = 0; 386 for (int chip=0;chip<NUM_CHIPS;chip++) { 387 for (int cell=0;cell<NUM_CELLS;cell++) { 388 for(x=0;x<CELL_WIDTH;x++) { 389 for (y=0;y<CELL_HEIGHT;y++) { 390 fpaCoord.x = (double) xFPA; 391 fpaCoord.y = (double) y; 392 printf("------------------ (%f, %f) ------------------\n", fpaCoord.x, fpaCoord.y); 393 } 394 xFPA++; 395 xReadout++; 396 } 397 // We skip the gaps between cells. 398 for(x=0;x<CELL_GAP;x++) { 399 printf("Column %d is CELL GAP\n", xFPA); 400 xFPA++; 401 xReadout=0; 402 } 403 } 404 // We skip the gaps between chips. 405 for (x=0;x<CHIP_GAP;x++) { 406 printf("Column %d is CHIP GAP\n", xFPA); 407 xFPA++; 408 xReadout=0; 409 } 410 } 411 412 psFree(myFPA); 413 return(0); 414 } 415 416 int printCell(psCell *cell) 417 { 418 psReadout **readouts = (psReadout **) cell->readouts->data; 419 psReadout *readout = readouts[0]; 420 421 printf("-------------------------------\n"); 422 for (int i = 0; i < readout->image->numRows ; i++) { 423 for (int j = 0; j < readout->image->numCols ; j++) { 424 printf("(%.1f) ", readout->image->data.F32[i][j]); 425 } 426 printf("\n"); 427 } 428 return(0); 429 } 430 431 432 /****************************************************************************** 433 This routine tests many Astrometry functions: 434 psChipInFPA() 435 psCellInFPA() 436 psCoordFPAToChip() 437 psCoordChipToCell() 438 This routine loops through all valid cell coordinates and maintains a running 439 set of (x,y) coordinates in the FPA plane. It calls the first two functions 440 with each FPA coordinate and determines the chip/cell that that coordinate 441 corresponds to. It then calls the last two functions to determine the actual 442 chip and cell coordinates. The cell coordinate is verified for correctness. 443 444 It then calls 445 psCoordCellToChip() 446 to determine if the chip coordinates that were generated agree with the chip 447 coords returned above. 448 449 Then, it calls 450 psCellInChip() 451 and flags an ERROR if the cell it returns is different from that of 452 psCellInFPA(). 453 454 Then, it calls 455 psCoordChipToFPA 456 to determine if the FPA coordinates are correct. 457 458 459 *****************************************************************************/ 297 460 int test3( void ) 298 461 { 299 genSystem(); 462 int x; 463 int y; 464 psPlane fpaCoord; 465 psFPA *myFPA = genSystem(); 466 psCell *myCell = NULL; 467 psPlane chipCoord; 468 psPlane cellCoord; 469 psPlane testCoord; 470 471 int xReadout = 0; 472 int xFPA = 0; 473 for (int chip=0;chip<NUM_CHIPS;chip++) { 474 for (int cell=0;cell<NUM_CELLS;cell++) { 475 for(x=0;x<CELL_WIDTH;x++) { 476 for (y=0;y<CELL_HEIGHT;y++) { 477 fpaCoord.x = (double) xFPA; 478 fpaCoord.y = (double) y; 479 //printf("------------------ (%f, %f) ------------------\n", fpaCoord.x, fpaCoord.y); 480 psChip* tmpChip = psChipInFPA(&fpaCoord, myFPA); 481 myCell = psCellInFPA(&fpaCoord, myFPA); 482 483 if ((myCell == NULL) || (tmpChip == NULL)) { 484 printf("ERROR: NULL\n"); 485 } else { 486 psCoordFPAToChip(&chipCoord, &fpaCoord, tmpChip); 487 psCoordChipToCell(&cellCoord, &chipCoord, myCell); 488 489 if (x != (int) cellCoord.x) { 490 printf("ERROR: x coord was %f, should be %d\n", cellCoord.x, x); 491 } 492 if (y != (int) cellCoord.y) { 493 printf("ERROR: y coord was %f, should be %d\n", cellCoord.y, y); 494 } 495 496 psCoordCellToChip(&testCoord, &cellCoord, myCell); 497 if (testCoord.x != chipCoord.x) { 498 printf("ERROR: psCoordCellToChip() x coord was %f, should be %d\n", cellCoord.x, x); 499 } 500 if (testCoord.y != chipCoord.y) { 501 printf("ERROR: psCoordCellToChip() y coord was %f, should be %d\n", cellCoord.y, y); 502 } 503 504 psCell *myCell2 = psCellInChip(&chipCoord, tmpChip); 505 if (myCell2 != myCell) { 506 printf("ERROR: psCellInFPA() != psCellInChip(psChipInFPA()) (%d %d)\n", myCell2, myCell); 507 printCell(myCell2); 508 printCell(myCell); 509 510 } 511 512 psCoordChipToFPA(&testCoord, &chipCoord, tmpChip); 513 if (testCoord.x != xFPA) { 514 printf("ERROR: psCoordChipToFPA() x coord was %f, should be %d\n", cellCoord.x, x); 515 } 516 if (testCoord.y != y) { 517 printf("ERROR: psCoordChipToFPA() y coord was %f, should be %d\n", cellCoord.y, y); 518 } 519 520 psCoordFPAToTP(&testCoord, &fpaCoord, 0.0, 0.0, myFPA); 521 if (testCoord.x != fpaCoord.x) { 522 printf("ERROR: psCoordFPAToTP() x coord was %f, should be %d\n", cellCoord.x, x); 523 } 524 if (testCoord.y != fpaCoord.y) { 525 printf("ERROR: psCoordFPAToTP() y coord was %f, should be %d\n", cellCoord.y, y); 526 } 527 528 psCoordCellToFPA(&testCoord, &cellCoord, myCell); 529 if (testCoord.x != fpaCoord.x) { 530 printf("ERROR: psCoordFPAToTP() x coord was %f, should be %d\n", cellCoord.x, x); 531 } 532 if (testCoord.y != fpaCoord.y) { 533 printf("ERROR: psCoordFPAToTP() y coord was %f, should be %d\n", cellCoord.y, y); 534 } 535 536 psCoordTPToFPA(&testCoord, &fpaCoord, 0.0, 0.0, myFPA); 537 if (testCoord.x != fpaCoord.x) { 538 printf("ERROR: psCoordFPAToTP() x coord was %f, should be %d\n", cellCoord.x, x); 539 } 540 if (testCoord.y != fpaCoord.y) { 541 printf("ERROR: psCoordFPAToTP() y coord was %f, should be %d\n", cellCoord.y, y); 542 } 543 } 544 } 545 xFPA++; 546 xReadout++; 547 } 548 // We skip the gaps between cells. 549 for(x=0;x<CELL_GAP;x++) { 550 xFPA++; 551 xReadout=0; 552 } 553 } 554 // We skip the gaps between chips. 555 for (x=0;x<CHIP_GAP;x++) { 556 xFPA++; 557 xReadout=0; 558 } 559 } 560 561 psFree(myFPA); 300 562 return(0); 301 563 } 564 //This code is -
trunk/psLib/test/astronomy/tst_psAstrometry03.c
r2067 r2096 25 25 26 26 psMemCheckLeaks(0,NULL,stderr); 27 28 27 return(0); 29 28 } -
trunk/psLib/test/astronomy/tst_psCoord.c
r2051 r2096 1 1 /** @file tst_psImageManip.c 2 2 * 3 * @brief Contains the tests for psImageManip.[ch]3 * @brief The code will ... 4 4 * 5 5 * 6 * @author Robert DeSonia, MHPCC6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-10-1 2 03:28:47$8 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-10-13 23:58:20 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 18 18 static int test2( void ); 19 19 static int test3( void ); 20 21 // test descrription consists of: 22 // * test function 23 // 24 // * testpoint number (item number in gforge testpoint log) 25 // 26 // * name of the testpoint 27 // 28 // * expected return value (negative numbers are signal types, e.g., 29 // -6 for aborts). Usually either -6 (psAbort called) or 0. 30 // 31 // * boolean to signify if the test function is already in list, i.e., if 32 // the test function covers multiple testpoints. If true, the line is 33 // ignored by runTestSuite if the user didn't explicitly specify the 34 // testpoint with the -n or -t option, as to not run a test function 35 // multiple times. 36 // 20 static int test4( void ); 21 static int test5( void ); 22 static int test6( void ); 23 static int test7( void ); 24 static int test8( void ); 25 static int test20( void ); 26 static int test21( void ); 27 static int test40( void ); 28 static int test41( void ); 29 37 30 testDescription tests[] = { 38 { 39 test1, 1111, "psFunctionBar", 0, false 40 }, 41 { 42 test2, 1113, "psFunctionFoo", 0, false 43 }, 44 { 45 test3, 1114, "psFunctionFunk", 0, false 46 }, 47 48 // testpoint #1112 handled by same test function as #1111 49 { 50 test1, 1112, "psFunctionBang", 0, true 51 }, 52 53 // A null terminates the testDescription list 54 { 55 NULL 56 } 31 {test1, 0000, "psSphereTransformAlloc()", 0, false}, 32 {test2, 0000, "psPlaneTransformApply()", 0, false}, 33 {test3, 0000, "psPlaneDistortApply()", 0, false}, 34 {test4, 0000, "psPSphereTransformApply()", 0, false}, 35 {test5, 0000, "psSphereTransformICRStoEcliptic()", 0, false}, 36 {test6, 0000, "psSphereTransformEcliptictoICRS()", 0, false}, 37 {test7, 0000, "psSphereTransformICRStoGalatic()", 0, false}, 38 {test8, 0000, "psSphereTransformGalatictoICRS()", 0, false}, 39 {test20, 0000, "psProject()", 0, false}, 40 {test21, 0000, "psDeProject()", 0, false}, 41 {test40, 0000, "psSphereGetOffset()", 0, false}, 42 {test41, 0000, "psSphereSetOffset()", 0, false}, 43 {NULL} 57 44 }; 58 45 46 #define ARCSEC_TO_RAD (M_PI / (180.0 * 60.0 * 60.0)) 47 #define ARCMIN_TO_RAD (M_PI / (180.0 * 60.0)) 48 #define DEG_TO_RAD (M_PI / 180.0) 49 #define RAD_TO_DEG (180.0 / M_PI) 50 #define RAD_TO_ARCMIN ((180.0 * 60.0) / M_PI) 51 #define RAD_TO_ARCSEC ((180.0 * 60.0 * 60.0) / M_PI) 52 53 59 54 int main( int argc, char* argv[] ) 60 55 { … … 64 59 } 65 60 61 #define MY_TINY 0.0001 62 #define PS_COMPARE_TINY_THEN_PRINT_ERROR(ACTUAL, EXPECT, TESTSTATUS) \ 63 if (MY_TINY < fabs(EXPECT - ACTUAL)) { \ 64 printf("ERROR: %s is %f, should be %f\n", #ACTUAL, ACTUAL, EXPECT); \ 65 testStatus = TESTSTATUS; \ 66 } 67 #define MY_TINY 0.0001 68 #define PS_COMPARE_EPSILON_THEN_PRINT_ERROR(ACTUAL, EXPECT, TESTSTATUS) \ 69 if (MY_TINY < fabs(EXPECT - ACTUAL)) { \ 70 printf("ERROR: %s is %f, should be %f\n", #ACTUAL, ACTUAL, EXPECT); \ 71 testStatus = TESTSTATUS; \ 72 } 73 74 #define PS_COT(X) (1.0 / atan(X)) 75 float p_psArg(float x, 76 float y) 77 { 78 if (y!= 0.0) { 79 return(atan(y/x)); 80 } else { 81 return(0.5 * M_PI); 82 } 83 return (0.0); 84 } 85 86 #define NPLAT 1.0 87 #define X0_BIG 2.0 88 #define X0_SMALL 2.0 89 66 90 int test1( void ) 67 91 { 68 // no need to check for memory leaks, as the runTestSuite does that for you. 69 70 // here is where one implements the tests for generally a single testpoint. 71 72 return 0; // the value that indicates success is part of the testDescription 73 } 74 92 float tmpF32; 93 int testStatus = 0; 94 psSphereTransform *myST = psSphereTransformAlloc(NPLAT, X0_BIG, X0_SMALL); 95 96 tmpF32 = sin(NPLAT); 97 if (FLT_EPSILON < fabs(tmpF32 - myST->sinPhi)) { 98 printf("ERROR: myST->sinPhi is %f, should be %f\n", myST->sinPhi, tmpF32); 99 testStatus = 1; 100 } 101 tmpF32 = cos(NPLAT); 102 if (FLT_EPSILON < fabs(tmpF32 - myST->cosPhi)) { 103 printf("ERROR: myST->cosPhi is %f, should be %f\n", myST->cosPhi, tmpF32); 104 testStatus = 2; 105 } 106 107 if (FLT_EPSILON < fabs(X0_BIG - myST->Xo)) { 108 printf("ERROR: myST->Xo is %f, should be %f\n", myST->Xo, X0_BIG); 109 testStatus = 3; 110 } 111 112 if (FLT_EPSILON < fabs(X0_SMALL - myST->xo)) { 113 printf("ERROR: myST->xo is %f, should be %f\n", myST->xo, X0_SMALL); 114 testStatus = 4; 115 } 116 117 psFree(myST); 118 return(testStatus); 119 } 120 121 #define N 10 122 // We do a simple identity transformation on a few x,y pairs. 75 123 int test2( void ) 76 124 { 77 // no need to check for memory leaks, as the runTestSuite does that for you. 78 79 // here is where one implements the tests for generally a single testpoint. 80 81 return 0; // the value that indicates success is part of the testDescription 82 } 83 125 int i; 126 int testStatus = 0; 127 psPlane in; 128 psPlane out; 129 psPlaneTransform pt; 130 131 pt.x = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD); 132 pt.y = psDPolynomial2DAlloc(2, 2, PS_POLYNOMIAL_ORD); 133 pt.x->coeff[1][0] = 1.0; 134 pt.y->coeff[0][1] = 1.0; 135 for (i=0;i<N;i++) { 136 in.x = (float) i; 137 in.y = (float) (i + 5.0); 138 in.xErr = 0.0; 139 in.yErr = 0.0; 140 psPlaneTransformApply(&out, &pt, &in); 141 142 if (FLT_EPSILON < fabs(out.x - in.x)) { 143 printf("ERROR: out.x is %f, should be %f\n", out.x, in.x); 144 testStatus = 3; 145 } 146 147 if (FLT_EPSILON < fabs(out.y - in.y)) { 148 printf("ERROR: out.y is %f, should be %f\n", out.y, in.y); 149 testStatus = 4; 150 } 151 //printf("psPlaneTransformApply(): (%f, %f) -> (%f, %f)\n", in.x, in.y, out.x, out.y); 152 } 153 154 psFree(pt.x); 155 psFree(pt.y); 156 return(testStatus); 157 } 158 159 #define COLOR 1.0 160 #define MAGNITUDE 1.0 161 // We do a simple identity transformation on a few x,y pairs. For x and y, 162 // we add in the COLOR and MAGNITUDE. 84 163 int test3( void ) 85 164 { 86 // no need to check for memory leaks, as the runTestSuite does that for you. 87 88 // here is where one implements the tests for generally a single testpoint. 89 90 return 0; // the value that indicates success is part of the testDescription 91 } 92 165 int i; 166 int testStatus = 0; 167 psPlane in; 168 psPlane out; 169 psPlaneDistort pt; 170 171 pt.x = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD); 172 pt.y = psDPolynomial4DAlloc(2, 2, 2, 2, PS_POLYNOMIAL_ORD); 173 pt.x->coeff[1][0][0][0] = 1.0; 174 pt.x->coeff[0][0][1][0] = 1.0; 175 pt.x->coeff[0][0][0][1] = 1.0; 176 pt.y->coeff[0][1][0][0] = 1.0; 177 pt.y->coeff[0][0][1][0] = 1.0; 178 pt.y->coeff[0][0][0][1] = 1.0; 179 for (i=0;i<N;i++) { 180 in.x = (float) i; 181 in.y = (float) (i + 5.0); 182 in.xErr = 0.0; 183 in.yErr = 0.0; 184 psPlaneDistortApply(&out, &pt, &in, COLOR, MAGNITUDE); 185 186 if (FLT_EPSILON < fabs(out.x - COLOR - MAGNITUDE - in.x)) { 187 printf("ERROR: out.x is %f, should be %f\n", out.x, in.x + COLOR + MAGNITUDE); 188 testStatus = 3; 189 } 190 191 if (FLT_EPSILON < fabs(out.y - COLOR - MAGNITUDE - in.y)) { 192 printf("ERROR: out.y is %f, should be %f\n", out.y, in.y + COLOR + MAGNITUDE); 193 testStatus = 3; 194 } 195 //printf("psPlaneTransformApply(): (%f, %f) -> (%f, %f)\n", in.x, in.y, out.x, out.y); 196 } 197 198 psFree(pt.x); 199 psFree(pt.y); 200 return(testStatus); 201 } 202 203 #define DEG_INC 30.0 204 // We do a simple identity transformation on a few RA, DEC pairs. 205 int test4( void ) 206 { 207 int i; 208 int testStatus = 0; 209 psSphere in; 210 psSphere out; 211 psSphereTransform *myST = psSphereTransformAlloc(0.0, 0.0, 0.0); 212 213 in.r = 45.0 * DEG_TO_RAD; 214 in.d = 30.0 * DEG_TO_RAD; 215 in.rErr = 0.0; 216 in.dErr = 0.0; 217 218 for (float r=0.0;r<180.0;r+=DEG_INC) { 219 for (float d=0.0;d<90.0;d+=DEG_INC) { 220 in.r = r * DEG_TO_RAD; 221 in.d = d * DEG_TO_RAD; 222 in.rErr = 0.0; 223 in.dErr = 0.0; 224 225 psSphereTransformApply(&out, myST, &in); 226 227 if (FLT_EPSILON < fabs(out.r - in.r)) { 228 printf("ERROR: out.r is %f, should be %f\n", out.r, in.r); 229 testStatus = 4; 230 } 231 232 if (FLT_EPSILON < fabs(out.d - in.d)) { 233 printf("ERROR: out.d is %f, should be %f\n", out.d, in.d); 234 testStatus = 5; 235 } 236 // printf("psSphereTransformApply (%f, %f) -> (%f, %f)\n", out.r, out.d, in.r, in.d); 237 } 238 } 239 240 psFree(myST); 241 return(testStatus); 242 } 243 244 int test5( void ) 245 { 246 int testStatus = 0; 247 psTime* now = psTimeGetTime(PS_TIME_UTC); 248 struct tm *tm_time = psTimeToTM(now); 249 250 // XXX: This test code is simply a copy of the original source code. 251 double year = (double)(1900 + tm_time->tm_year); 252 double T = year / 100.0; 253 double phi = -23.452294 + 0.013013 * T + 0.000001639 * T * T - 0.000000503 * T * T * T; 254 psSphereTransform *myST = psSphereTransformICRStoEcliptic(*now); 255 256 if (FLT_EPSILON < fabs(sin(phi) - myST->sinPhi)) { 257 printf("ERROR: myST->sinPhi is %f, should be %f\n", myST->sinPhi, sin(phi)); 258 testStatus = 1; 259 } 260 261 if (FLT_EPSILON < fabs(cos(phi) - myST->cosPhi)) { 262 printf("ERROR: myST->cosPhi is %f, should be %f\n", myST->cosPhi, cos(phi)); 263 testStatus = 2; 264 } 265 266 if (FLT_EPSILON < fabs(0.0 - myST->Xo)) { 267 printf("ERROR: myST->Xo is %f, should be %f\n", myST->Xo, X0_BIG); 268 testStatus = 3; 269 } 270 271 if (FLT_EPSILON < fabs(0.0 - myST->xo)) { 272 printf("ERROR: myST->xo is %f, should be %f\n", myST->xo, X0_SMALL); 273 testStatus = 4; 274 } 275 276 psFree(myST); 277 psFree(tm_time); 278 psFree(now); 279 return(testStatus); 280 } 281 282 283 int test6( void ) 284 { 285 int testStatus = 0; 286 psTime* now = psTimeGetTime(PS_TIME_UTC); 287 struct tm *tm_time = psTimeToTM(now); 288 289 // XXX: This test code is simply a copy of the original source code. 290 double year = (double)(1900 + tm_time->tm_year); 291 double T = year / 100.0; 292 double phi = +23.452294 - 0.013013 * T - 0.000001639 * T * T + 0.000000503 * T * T * T; 293 psSphereTransform *myST = psSphereTransformEcliptictoICRS(*now); 294 295 if (FLT_EPSILON < fabs(sin(phi) - myST->sinPhi)) { 296 printf("ERROR: myST->sinPhi is %f, should be %f\n", myST->sinPhi, sin(phi)); 297 testStatus = 1; 298 } 299 300 if (FLT_EPSILON < fabs(cos(phi) - myST->cosPhi)) { 301 printf("ERROR: myST->cosPhi is %f, should be %f\n", myST->cosPhi, cos(phi)); 302 testStatus = 2; 303 } 304 305 if (FLT_EPSILON < fabs(0.0 - myST->Xo)) { 306 printf("ERROR: myST->Xo is %f, should be %f\n", myST->Xo, X0_BIG); 307 testStatus = 3; 308 } 309 310 if (FLT_EPSILON < fabs(0.0 - myST->xo)) { 311 printf("ERROR: myST->xo is %f, should be %f\n", myST->xo, X0_SMALL); 312 testStatus = 4; 313 } 314 315 psFree(myST); 316 psFree(tm_time); 317 psFree(now); 318 return(testStatus); 319 } 320 321 322 int test7( void ) 323 { 324 int testStatus = 0; 325 // XXX: This test code is simply a copy of the original source code. 326 double phi = 62.6; 327 double Xo = 282.25; 328 double xo = 33.0; 329 psSphereTransform *myST = psSphereTransformICRStoGalatic(); 330 331 if (FLT_EPSILON < fabs(sin(phi) - myST->sinPhi)) { 332 printf("ERROR: myST->sinPhi is %f, should be %f\n", myST->sinPhi, sin(phi)); 333 testStatus = 1; 334 } 335 336 if (FLT_EPSILON < fabs(cos(phi) - myST->cosPhi)) { 337 printf("ERROR: myST->cosPhi is %f, should be %f\n", myST->cosPhi, cos(phi)); 338 testStatus = 2; 339 } 340 341 if (FLT_EPSILON < fabs(Xo - myST->Xo)) { 342 printf("ERROR: myST->Xo is %f, should be %f\n", myST->Xo, Xo); 343 testStatus = 3; 344 } 345 346 if (FLT_EPSILON < fabs(xo - myST->xo)) { 347 printf("ERROR: myST->xo is %f, should be %f\n", myST->xo, xo); 348 testStatus = 4; 349 } 350 351 psFree(myST); 352 return(testStatus); 353 } 354 355 int test8( void ) 356 { 357 int testStatus = 0; 358 // XXX: This test code is simply a copy of the original source code. 359 double phi = -62.6; 360 double Xo = 33.0; 361 double xo = 282.25; 362 psSphereTransform *myST = psSphereTransformGalatictoICRS(); 363 364 if (FLT_EPSILON < fabs(sin(phi) - myST->sinPhi)) { 365 printf("ERROR: myST->sinPhi is %f, should be %f\n", myST->sinPhi, sin(phi)); 366 testStatus = 1; 367 } 368 369 if (FLT_EPSILON < fabs(cos(phi) - myST->cosPhi)) { 370 printf("ERROR: myST->cosPhi is %f, should be %f\n", myST->cosPhi, cos(phi)); 371 testStatus = 2; 372 } 373 374 if (FLT_EPSILON < fabs(Xo - myST->Xo)) { 375 printf("ERROR: myST->Xo is %f, should be %f\n", myST->Xo, Xo); 376 testStatus = 3; 377 } 378 379 if (FLT_EPSILON < fabs(xo - myST->xo)) { 380 printf("ERROR: myST->xo is %f, should be %f\n", myST->xo, xo); 381 testStatus = 4; 382 } 383 384 psFree(myST); 385 return(testStatus); 386 } 387 388 int test20( void ) 389 { 390 int i; 391 int testStatus = 0; 392 psSphere in; 393 double R; 394 double expectX; 395 double expectY; 396 psPlane *out; 397 psProjection myProjection; 398 myProjection.R = 20.0 * DEG_TO_RAD; 399 myProjection.D = 10.0 * DEG_TO_RAD; 400 myProjection.Xs = 1.0; 401 myProjection.Ys = 1.0; 402 403 for (float r=0.0;r<180.0;r+=DEG_INC) { 404 for (float d=0.0;d<90.0;d+=DEG_INC) { 405 in.r = r * DEG_TO_RAD; 406 in.d = d * DEG_TO_RAD; 407 in.rErr = 0.0; 408 in.dErr = 0.0; 409 410 /****************************************************************** 411 Tangent Plane Projection 412 *****************************************************************/ 413 myProjection.type = PS_PROJ_TAN; 414 out = psProject(&in, &myProjection); 415 416 R = PS_COT(in.r) * (180.0 / M_PI); 417 expectX = R * sin(in.d); 418 expectY = R * cos(in.d); 419 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->x, expectX, 1); 420 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->y, expectY, 2); 421 psFree(out); 422 423 /****************************************************************** 424 PS_PROJ_SIN Projection 425 *****************************************************************/ 426 myProjection.type = PS_PROJ_SIN; 427 out = psProject(&in, &myProjection); 428 429 R = cos(in.r) * (180.0 / M_PI); 430 expectX = R * sin(in.d); 431 expectY = R * cos(in.d); 432 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->x, expectX, 3); 433 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->y, expectY, 4); 434 psFree(out); 435 436 /****************************************************************** 437 PS_PROJ_CAR Projection 438 *****************************************************************/ 439 myProjection.type = PS_PROJ_CAR; 440 out = psProject(&in, &myProjection); 441 442 expectX = in.d; 443 expectY = in.r; 444 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->x, expectX, 5); 445 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->y, expectY, 6); 446 psFree(out); 447 448 /****************************************************************** 449 PS_PROJ_MER Projection 450 *****************************************************************/ 451 myProjection.type = PS_PROJ_MER; 452 out = psProject(&in, &myProjection); 453 454 expectX = in.d; 455 expectY = log(tan(45.0 + (0.5 * in.r))) * 180.0 / M_PI; 456 457 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->x, expectX, 7); 458 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->y, expectY, 8); 459 psFree(out); 460 461 /****************************************************************** 462 PS_PROJ_AIT Projection 463 *****************************************************************/ 464 myProjection.type = PS_PROJ_AIT; 465 out = psProject(&in, &myProjection); 466 467 double alpha = 1.0 / ((180.0 / M_PI) * sqrt(1.0 + (cos(in.r) * 468 cos(0.5 * in.d) * 0.5))); 469 expectX = 2.0 * alpha * cos(in.r) * sin(0.5 * in.d); 470 expectY = alpha * sin(in.d); 471 472 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->x, expectX, 7); 473 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->y, expectY, 8); 474 psFree(out); 475 476 477 } 478 } 479 return(testStatus); 480 } 481 482 #define SPACE_INC 10.0 483 int test21( void ) 484 { 485 int testStatus = 0; 486 psPlane in; 487 double R; 488 double expectD; 489 double expectR; 490 psSphere *out; 491 psProjection myProjection; 492 myProjection.R = 20.0 * DEG_TO_RAD; 493 myProjection.D = 10.0 * DEG_TO_RAD; 494 myProjection.Xs = 1.0; 495 myProjection.Ys = 1.0; 496 497 in.xErr = 0.0; 498 in.yErr = 0.0; 499 for (in.x=0.0; in.x<100.0; in.x+=SPACE_INC) { 500 for (in.y=0.0;in.y<100.0;in.y+=SPACE_INC) { 501 502 /****************************************************************** 503 Tangent Plane Projection 504 *****************************************************************/ 505 myProjection.type = PS_PROJ_TAN; 506 out = psDeproject(&in, &myProjection); 507 508 R = sqrt((in.x * in.x) + (in.y * in.y)); 509 expectD = p_psArg(-in.y, in.x); 510 expectR = atan(180.0 / (R * M_PI)); 511 512 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->r, expectR, 1); 513 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->d, expectD, 2); 514 psFree(out); 515 516 /****************************************************************** 517 PS_PROJ_SIN Projection 518 *****************************************************************/ 519 myProjection.type = PS_PROJ_SIN; 520 out = psDeproject(&in, &myProjection); 521 522 R = sqrt((in.x * in.x) + (in.y * in.y)); 523 expectD = p_psArg(-in.y, in.x); 524 expectR = acos((R * M_PI) / 180.0); 525 526 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->r, expectR, 3); 527 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->d, expectD, 4); 528 psFree(out); 529 530 /****************************************************************** 531 PS_PROJ_CAR Projection 532 *****************************************************************/ 533 myProjection.type = PS_PROJ_CAR; 534 out = psDeproject(&in, &myProjection); 535 536 expectD = in.x; 537 expectR = in.y; 538 539 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->r, expectR, 3); 540 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->d, expectD, 4); 541 psFree(out); 542 543 /****************************************************************** 544 PS_PROJ_MER Projection 545 *****************************************************************/ 546 myProjection.type = PS_PROJ_MER; 547 out = psDeproject(&in, &myProjection); 548 549 expectD = in.x; 550 expectR = (2.0 * atan(exp((in.y * M_PI / 180.0)))) - 180.0; 551 552 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->r, expectR, 3); 553 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->d, expectD, 4); 554 psFree(out); 555 556 557 /****************************************************************** 558 PS_PROJ_AIT Projection 559 *****************************************************************/ 560 myProjection.type = PS_PROJ_AIT; 561 out = psDeproject(&in, &myProjection); 562 563 float chu1 = (in.x * M_PI) / 720.0; 564 chu1 *= chu1; 565 float chu2 = (in.y * M_PI) / 360.0; 566 chu2 *= chu2; 567 float chu = sqrt(1.0 - chu1 - chu2); 568 expectD = 2.0 * p_psArg((2.0 * chu * chu) - 1.0, (in.x * chu * M_PI) / 360.0); 569 expectR = asin((in.y * chu * M_PI) / 180.0); 570 571 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->r, expectR, 3); 572 PS_COMPARE_TINY_THEN_PRINT_ERROR(out->d, expectD, 4); 573 psFree(out); 574 } 575 } 576 return(testStatus); 577 } 578 579 int test40( void ) 580 { 581 int testStatus = 0; 582 psSphere position1; 583 psSphere position2; 584 psSphere *offset = NULL; 585 586 position1.r = 90.0 * DEG_TO_RAD; 587 position1.d = 45.0 * DEG_TO_RAD; 588 position1.rErr = 0.0; 589 position1.dErr = 0.0; 590 591 for (float r=0.0;r<180.0;r+=DEG_INC) { 592 for (float d=0.0;d<90.0;d+=DEG_INC) { 593 position2.r = r * DEG_TO_RAD; 594 position2.d = d * DEG_TO_RAD; 595 position2.rErr = 0.0; 596 position2.dErr = 0.0; 597 598 offset = psSphereGetOffset(&position1, &position2, 599 PS_SPHERICAL, PS_RADIAN); 600 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 1); 601 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 1); 602 psFree(offset); 603 604 offset = psSphereGetOffset(&position1, &position2, 605 PS_SPHERICAL, PS_DEGREE); 606 offset->r = offset->r * DEG_TO_RAD; 607 offset->d = offset->d * DEG_TO_RAD; 608 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 2); 609 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 3); 610 psFree(offset); 611 612 offset = psSphereGetOffset(&position1, &position2, 613 PS_SPHERICAL, PS_ARCMIN); 614 offset->r = offset->r * ARCMIN_TO_RAD; 615 offset->d = offset->d * ARCMIN_TO_RAD; 616 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 2); 617 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 3); 618 psFree(offset); 619 620 offset = psSphereGetOffset(&position1, &position2, 621 PS_SPHERICAL, PS_ARCSEC); 622 offset->r = offset->r * ARCSEC_TO_RAD; 623 offset->d = offset->d * ARCSEC_TO_RAD; 624 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 2); 625 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 3); 626 psFree(offset); 627 628 /* XXX: This code does not work correctly. 629 offset = psSphereGetOffset(&position1, &position2, 630 PS_LINEAR, 0); 631 printf("--------------- (%f, %f) to (%f, %f) is (%f, %f) ---------------\n", 632 position1.r, position1.d, position2.r, position2.d, 633 offset->r, offset->d); 634 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->r, (position2.r - position1.r), 1); 635 PS_COMPARE_TINY_THEN_PRINT_ERROR(offset->d, (position2.d - position1.d), 1); 636 psFree(offset); 637 */ 638 } 639 } 640 641 return(testStatus); 642 } 643 644 int test41( void ) 645 { 646 int testStatus = 0; 647 psSphere position1; 648 psSphere *position2; 649 psSphere offset; 650 psSphere tmpOffset; 651 652 position1.r = 90.0 * DEG_TO_RAD; 653 position1.d = 45.0 * DEG_TO_RAD; 654 position1.rErr = 0.0; 655 position1.dErr = 0.0; 656 657 for (float r=0.0;r<180.0;r+=DEG_INC) { 658 for (float d=0.0;d<90.0;d+=DEG_INC) { 659 offset.r = r * DEG_TO_RAD; 660 offset.d = d * DEG_TO_RAD; 661 offset.rErr = 0.0; 662 offset.dErr = 0.0; 663 664 position2 = psSphereSetOffset(&position1, &offset, 665 PS_SPHERICAL, PS_RADIAN); 666 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->r, (position1.r + offset.r), 1); 667 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->d, (position1.d + offset.d), 1); 668 psFree(position2); 669 670 tmpOffset.r = offset.r * RAD_TO_DEG; 671 tmpOffset.d = offset.d * RAD_TO_DEG; 672 tmpOffset.rErr = 0.0; 673 tmpOffset.dErr = 0.0; 674 position2 = psSphereSetOffset(&position1, &tmpOffset, 675 PS_SPHERICAL, PS_DEGREE); 676 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->r, (position1.r + offset.r), 1); 677 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->d, (position1.d + offset.d), 1); 678 psFree(position2); 679 680 tmpOffset.r = offset.r * RAD_TO_ARCMIN; 681 tmpOffset.d = offset.d * RAD_TO_ARCMIN; 682 tmpOffset.rErr = 0.0; 683 tmpOffset.dErr = 0.0; 684 position2 = psSphereSetOffset(&position1, &tmpOffset, 685 PS_SPHERICAL, PS_ARCMIN); 686 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->r, (position1.r + offset.r), 1); 687 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->d, (position1.d + offset.d), 1); 688 psFree(position2); 689 690 tmpOffset.r = offset.r * RAD_TO_ARCSEC; 691 tmpOffset.d = offset.d * RAD_TO_ARCSEC; 692 tmpOffset.rErr = 0.0; 693 tmpOffset.dErr = 0.0; 694 position2 = psSphereSetOffset(&position1, &tmpOffset, 695 PS_SPHERICAL, PS_ARCSEC); 696 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->r, (position1.r + offset.r), 1); 697 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->d, (position1.d + offset.d), 1); 698 psFree(position2); 699 700 /* XXX: This code does not work correctly. 701 position2 = psSphereSetOffset(&position1, &offset, 702 PS_LINEAR, 0); 703 printf("--------------- (%f, %f) and (%f, %f) is (%f, %f) ---------------\n", 704 position1.r, position1.d, offset.r, offset.d, 705 position2->r, position2->d); 706 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->r, (position1.r + offset.r), 1); 707 PS_COMPARE_TINY_THEN_PRINT_ERROR(position2->d, (position1.d + offset.d), 1); 708 psFree(position2); 709 */ 710 } 711 } 712 713 return(testStatus); 714 }
Note:
See TracChangeset
for help on using the changeset viewer.
