IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6390


Ignore:
Timestamp:
Feb 8, 2006, 3:21:31 PM (20 years ago)
Author:
gusciora
Message:

The check-in comes after the complete rewrite of the psPlaneTransform-
Fit and -Invert routine.

Location:
trunk/psLib/test/astro
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/tst_psCoord02.c

    r6268 r6390  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2006-01-31 23:24:21 $
     8*  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2006-02-09 01:21:31 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    280280#define TST05_NUM_X 5.0
    281281#define TST05_NUM_Y 5.0
    282 #define TST05_X_POLY_ORDER 2
    283 #define TST05_Y_POLY_ORDER 2
     282#define TST05_X_POLY_ORDER 3
     283#define TST05_Y_POLY_ORDER 3
    284284#define TST05_NUM_DATA (TST05_NUM_X * TST05_NUM_Y)
     285#define TST05_IGNORE 1
     286#define TST05_VERBOSE 0
    285287/******************************************************************************
    286288XXX: This is only a rudimentary test of the psPlaneTransformFit() function.
    287289It tests a few NULL input parameter conditions, and some simple linear
    288290transformations.
     291 
     292// HEY
    289293 *****************************************************************************/
    290294psS32 test05( void )
     
    300304    // We set an arbitrary non-linear transformation.
    301305    //
    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++) {
    304308            transInit->x->coeff[x][y] = (psF32)rand() / (psF32)RAND_MAX * 10.0f;
    305309            transInit->y->coeff[x][y] = (psF32)rand() / (psF32)RAND_MAX * 10.0f;
    306310        }
    307311    }
    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
    326317    //
    327318    // We generate a grid of input data points in the x1,y1 plane, calculate the
     
    371362        printf("TEST ERROR: psPlaneTransformFit() returned FALSE.\n");
    372363        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        }
    392390    }
    393391
     
    406404    A few NULL input parameter conditions.
    407405    Several random linear transformations.
    408 XXX: Must test:
     406XXX: Must extensively test:
    409407    Non-linear transformations.
    410408  *****************************************************************************/
  • trunk/psLib/test/astro/verified/tst_psCoord02.stderr

    r6268 r6390  
    3636    Unallowable operation: in is NULL.
    3737<HOST>|E|psPlaneTransformInvert (FILE:LINENO)
    38     Error: !(nSamples >= 1) (0 1).
     38    Error: !(nSamples > 0) (0 0).
    3939
    4040---> TESTPOINT PASSED (psImage{psPlaneTransformInvert()} | tst_psCoord02.c)
Note: See TracChangeset for help on using the changeset viewer.