Changeset 6390
- Timestamp:
- Feb 8, 2006, 3:21:31 PM (20 years ago)
- Location:
- trunk/psLib/test/astro
- Files:
-
- 2 edited
-
tst_psCoord02.c (modified) (5 diffs)
-
verified/tst_psCoord02.stderr (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astro/tst_psCoord02.c
r6268 r6390 6 6 * @author GLG, MHPCC 7 7 * 8 * @version $Revision: 1. 4$ $Name: not supported by cvs2svn $9 * @date $Date: 2006-0 1-31 23:24:21 $8 * @version $Revision: 1.5 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2006-02-09 01:21:31 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 280 280 #define TST05_NUM_X 5.0 281 281 #define TST05_NUM_Y 5.0 282 #define TST05_X_POLY_ORDER 2283 #define TST05_Y_POLY_ORDER 2282 #define TST05_X_POLY_ORDER 3 283 #define TST05_Y_POLY_ORDER 3 284 284 #define TST05_NUM_DATA (TST05_NUM_X * TST05_NUM_Y) 285 #define TST05_IGNORE 1 286 #define TST05_VERBOSE 0 285 287 /****************************************************************************** 286 288 XXX: This is only a rudimentary test of the psPlaneTransformFit() function. 287 289 It tests a few NULL input parameter conditions, and some simple linear 288 290 transformations. 291 292 // HEY 289 293 *****************************************************************************/ 290 294 psS32 test05( void ) … … 300 304 // We set an arbitrary non-linear transformation. 301 305 // 302 for (psS32 x = 0 ; x < TST05_X_POLY_ORDER ; x++) {303 for (psS32 y = 0 ; y < TST05_Y_POLY_ORDER ; y++) {306 for (psS32 x = 0 ; x < TST05_X_POLY_ORDER+1 ; x++) { 307 for (psS32 y = 0 ; y < TST05_Y_POLY_ORDER+1 ; y++) { 304 308 transInit->x->coeff[x][y] = (psF32)rand() / (psF32)RAND_MAX * 10.0f; 305 309 transInit->y->coeff[x][y] = (psF32)rand() / (psF32)RAND_MAX * 10.0f; 306 310 } 307 311 } 308 309 // okay, for now, it's linear. 310 transInit->x->coeff[1][1] = 0.1; 311 transInit->y->coeff[1][1] = 0.1; 312 313 /* 314 // 315 // We set an arbitrary linear transformation. 316 // 317 transInit->x->coeff[0][0] = 1.0; 318 transInit->x->coeff[0][1] = 3.0; 319 transInit->x->coeff[1][0] = 2.0; 320 transInit->x->coeff[1][1] = 7.0; 321 transInit->y->coeff[0][0] = 4.0; 322 transInit->y->coeff[0][1] = 6.0; 323 transInit->y->coeff[1][0] = 5.0; 324 transInit->y->coeff[1][1] = 3.0; 325 */ 312 if (TST05_VERBOSE) { 313 PS_POLY_PRINT_2D(transInit->x); 314 PS_POLY_PRINT_2D(transInit->y); 315 } 316 326 317 // 327 318 // We generate a grid of input data points in the x1,y1 plane, calculate the … … 371 362 printf("TEST ERROR: psPlaneTransformFit() returned FALSE.\n"); 372 363 testStatus = false; 373 } 374 375 // 376 // For the initial grid of input points, we transform them to output points with 377 // the derived transformation, and verify that they are within 10%. 378 // 379 380 // XXX: We ignore endpoints. 381 for (psS32 i = 1 ; i < src->n-1 ; i++) { 382 psPlane *inData = (psPlane *) src->data[i]; 383 psPlane *outData = (psPlane *) dst->data[i]; 384 psPlane *outDataDeriv = psPlaneTransformApply(NULL, trans, inData); 385 if (!PS_PERCENT_COMPARE(outDataDeriv->x, outData->x, 0.20) || 386 !PS_PERCENT_COMPARE(outDataDeriv->y, outData->y, 0.20)) { 387 printf("TEST ERROR: the derived output coords (%d) were (%f, %f) should have been (%f, %f).\n", 388 i, outDataDeriv->x, outDataDeriv->y, outData->x, outData->y); 389 testStatus = false; 390 } 391 psFree(outDataDeriv); 364 } else { 365 if (TST05_VERBOSE) { 366 PS_POLY_PRINT_2D(trans->x); 367 PS_POLY_PRINT_2D(trans->y); 368 } 369 370 // 371 // For the initial grid of input points, we transform them to output points with 372 // the derived transformation, and verify that they are within 10%. 373 // 374 375 for (psS32 i = TST05_IGNORE ; i < src->n-TST05_IGNORE ; i++) { 376 psPlane *inData = (psPlane *) src->data[i]; 377 psPlane *outData = (psPlane *) dst->data[i]; 378 psPlane *outDataDeriv = psPlaneTransformApply(NULL, trans, inData); 379 if (!PS_PERCENT_COMPARE(outDataDeriv->x, outData->x, 0.20) || 380 !PS_PERCENT_COMPARE(outDataDeriv->y, outData->y, 0.20)) { 381 printf("TEST ERROR: the derived output coords (%d) were (%.2f, %.2f) should have been (%.2f, %.2f).\n", 382 i, outDataDeriv->x, outDataDeriv->y, outData->x, outData->y); 383 testStatus = false; 384 } else if (TST05_VERBOSE) { 385 printf("GOOD: the derived output coords (%d) were (%.2f, %.2f) should have been (%.2f, %.2f).\n", 386 i, outDataDeriv->x, outDataDeriv->y, outData->x, outData->y); 387 } 388 psFree(outDataDeriv); 389 } 392 390 } 393 391 … … 406 404 A few NULL input parameter conditions. 407 405 Several random linear transformations. 408 XXX: Must test:406 XXX: Must extensively test: 409 407 Non-linear transformations. 410 408 *****************************************************************************/ -
trunk/psLib/test/astro/verified/tst_psCoord02.stderr
r6268 r6390 36 36 Unallowable operation: in is NULL. 37 37 <HOST>|E|psPlaneTransformInvert (FILE:LINENO) 38 Error: !(nSamples > = 1) (0 1).38 Error: !(nSamples > 0) (0 0). 39 39 40 40 ---> TESTPOINT PASSED (psImage{psPlaneTransformInvert()} | tst_psCoord02.c)
Note:
See TracChangeset
for help on using the changeset viewer.
