Changeset 6253
- Timestamp:
- Jan 30, 2006, 12:56:01 PM (20 years ago)
- Location:
- trunk/psLib
- Files:
-
- 3 edited
-
src/astro/psCoord.c (modified) (2 diffs)
-
test/astro/tst_psCoord.c (modified) (3 diffs)
-
test/astro/tst_psCoord02.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psCoord.c
r6251 r6253 10 10 * @author GLG, MHPCC 11 11 * 12 * @version $Revision: 1.10 3$ $Name: not supported by cvs2svn $13 * @date $Date: 2006-01-30 2 0:28:33$12 * @version $Revision: 1.104 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2006-01-30 22:56:01 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 1088 1088 //XXX: Should the length (nalloc) be 1 and append be used everytime a pixel is added? 1089 1089 // out = psPixelsAlloc(input->nalloc); 1090 out = psPixelsAlloc( 1);1090 out = psPixelsAlloc(0); 1091 1091 } 1092 1092 psPlane *coord = psPlaneAlloc(); -
trunk/psLib/test/astro/tst_psCoord.c
r6251 r6253 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 8$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-01-30 2 0:28:34$8 * @version $Revision: 1.9 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-01-30 22:56:01 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 396 396 } 397 397 398 input = psPixelsAlloc( 5);398 input = psPixelsAlloc(1); 399 399 /* for (int i = 0; i < 2; i++) { 400 400 input->data[i].x = i*1.0; … … 403 403 */ 404 404 input->data[0].x = 1.0; 405 input->data[0].y = 2.0;406 input->data[1].x = 1.0;407 input->data[1].y = 3.0;408 trans->x->nX = 1;405 input->data[0].y = 1.0; 406 // input->data[1].x = 1.0; 407 // input->data[1].y = 6.0; 408 trans->x->nX = 2; 409 409 trans->x->nY = 0; 410 trans->y->nX = 1;411 trans->y->nY = 0;410 trans->y->nX = 0; 411 trans->y->nY = 2; 412 412 trans->x->coeff[0][0] = 0; 413 trans->x->coeff[1][0] = 1 ;413 trans->x->coeff[1][0] = 1.0; 414 414 trans->y->coeff[0][0] = 0; 415 trans->y->coeff[1][0] = 2; 415 trans->y->coeff[0][0] = 0; 416 trans->y->coeff[0][2] = 0.5; 416 417 417 418 //Verify that the output pixels are what we expected 418 419 output = psPixelsTransform(output, input, trans); 419 printf("\n output return %ld pixels\n\n", output->n);420 int nExpected = 1;420 printf("\n output returned with %ld pixels\n\n", output->n); 421 int nExpected = 9; 421 422 if (output->n != nExpected) { 422 423 psError(PS_ERR_BAD_PARAMETER_SIZE, false, 423 424 "psPixelsTransform failed to return the expected number of pixels.\n"); 425 for (int i = 0; i < output->n; i++) { 426 printf(" (%6.2lf, %6.2lf) pixel %d\n", output->data[i].x, output->data[i].y, i); 427 } 424 428 return 3; 425 429 } 426 430 431 psFree(trans); 427 432 psFree(input); 428 433 psFree(output); 429 psFree(trans);430 434 431 435 return 0; -
trunk/psLib/test/astro/tst_psCoord02.c
r5580 r6253 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 2$ $Name: not supported by cvs2svn $9 * @date $Date: 200 5-11-23 01:03:18$8 * @version $Revision: 1.3 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-01-30 22:56:01 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 18 18 static psS32 test05( void ); 19 19 static psS32 test06( void ); 20 static psS32 test07( void ); 20 21 21 22 testDescription tests[] = { 22 {test04, 0000, "psPlaneTransformCombine()", 0, false}, 23 {test05, 0000, "psPlaneTransformFit()", 0, false}, 24 {test06, 0000, "psPlaneTransformInvert()", 0, false}, 23 {test04, 660, "psPlaneTransformCombine()", 0, false}, 24 {test05, 662, "psPlaneTransformFit()", 0, false}, 25 {test06, 663, "psPlaneTransformInvert()", 0, false}, 26 {test07, 666, "psPlaneTransformDeriv()", 0, false}, 25 27 {NULL} 26 28 }; … … 505 507 } 506 508 507 509 psS32 test07( void ) 510 { 511 psPlane *coord = psPlaneAlloc(); 512 psPlane *deriv = NULL; 513 psPlaneTransform *trans = NULL; 514 515 //Set fxn values for evaluation 516 coord->x = 1.0; 517 coord->y = 1.0; 518 519 //Return NULL for NULL input plane transform 520 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 521 deriv = psPlaneTransformDeriv(NULL, trans, coord); 522 if (deriv != NULL) { 523 psError(PS_ERR_BAD_PARAMETER_NULL, false, 524 "psPlaneTransformDeriv failed to return NULL for NULL plane transform input.\n"); 525 return 1; 526 } 527 528 trans = psPlaneTransformAlloc(1, 2); 529 530 //Set Polynomials. f(x) = x, f(y) = 0.5*y^2 --> f'(x) = 1, f'(y) = y 531 //So for 1,1 -> f'(1) = 1, f'(1) = 1 532 trans->x->nX = 1; 533 trans->x->nY = 0; 534 trans->y->nX = 0; 535 trans->y->nY = 2; 536 537 trans->x->coeff[0][0] = 0.0; 538 trans->x->coeff[1][0] = 1.0; 539 540 trans->y->coeff[0][0] = 0.0; 541 trans->y->coeff[0][1] = 0.0; 542 trans->y->coeff[0][2] = 0.5; 543 544 //Return NULL for NULL input plane 545 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 546 deriv = psPlaneTransformDeriv(NULL, trans, NULL); 547 if (deriv != NULL) { 548 psError(PS_ERR_BAD_PARAMETER_NULL, false, 549 "psPlaneTransformDeriv failed to return NULL for NULL plane input.\n"); 550 return 2; 551 } 552 553 //Return correct values. Should have x=1.0, y=1.0. 554 deriv = psPlaneTransformDeriv(NULL, trans, coord); 555 if (deriv->x != 1.0 || deriv->y != 1.0) { 556 psError(PS_ERR_BAD_PARAMETER_VALUE, false, 557 "psPlaneTransformDeriv failed to return the correct values.\n"); 558 printf("\n f' values are = %lf, %lf \n", deriv->x, deriv->y); 559 // return 3; 560 } 561 562 psFree(trans); 563 psFree(deriv); 564 psFree(coord); 565 566 return 0; 567 } 568
Note:
See TracChangeset
for help on using the changeset viewer.
