IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 18, 2005, 3:22:59 PM (21 years ago)
Author:
gusciora
Message:

The psTransformCombine() tests were significantly modified. They now
more fully test a wider range of transforms and data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/astro/psCoord.c

    r3682 r3711  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.62 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-04-07 20:27:41 $
     12*  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-04-19 01:22:59 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6161/*  FUNCTION IMPLEMENTATION - LOCAL                                          */
    6262/*****************************************************************************/
    63 /*****************************************************************************
    64 multiplyDPoly2D(trans1, trans2): Takes two 2-D polynomials as input and
    65 multiplies them.  Basically, for each non-zero coeff in the trans1 coeff[][]
    66 array, you must multiply by all non-zero coeffs in trans2.
    67  
    68 XXX: Inefficient in that the out polynomial is allocated every time.
    69  *****************************************************************************/
    70 
    71 psDPolynomial2D *multiplyDPoly2D(psDPolynomial2D *trans1,
    72                                  psDPolynomial2D *trans2)
    73 {
    74     psS32 orderX = (trans1->nX + trans2->nX) - 1;
    75     psS32 orderY = (trans1->nX + trans2->nX) - 1;
    76 
    77     psDPolynomial2D *out = psDPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD);
    78     for (psS32 i = 0 ; i < out->nX; i++) {
    79         for (psS32 j = 0 ; j < out->nY; j++) {
    80             out->coeff[i][j] = 0.0;
    81             out->mask[i][j] = 0;
    82         }
    83     }
    84 
    85     for (psS32 t1x = 0 ; t1x < trans1->nX ; t1x++) {
    86         for (psS32 t1y = 0 ; t1y < trans1->nY ; t1y++) {
    87             if (0.0 != trans1->coeff[t1x][t1y]) {
    88                 for (psS32 t2x = 0 ; t2x < trans2->nX ; t2x++) {
    89                     for (psS32 t2y = 0 ; t2y < trans2->nY ; t2y++) {
    90                         out->coeff[t1x+t2x][t1y+t2y]+= (trans1->coeff[t1x][t1y] * trans2->coeff[t2x][t2y]);
    91                     }
    92                 }
    93             }
    94         }
    95     }
    96     return(out);
    97 }
    9863
    9964/*****************************************************************************/
     
    861826}
    862827
     828/*****************************************************************************
     829multiplyDPoly2D(trans1, trans2): Takes two 2-D polynomials as input and
     830multiplies them.  Basically, for each non-zero coeff in the trans1 coeff[][]
     831array, you must multiply by all non-zero coeffs in trans2.
     832 
     833XXX: Inefficient in that the out polynomial is allocated every time.
     834 *****************************************************************************/
     835
     836psDPolynomial2D *multiplyDPoly2D(psDPolynomial2D *trans1,
     837                                 psDPolynomial2D *trans2)
     838{
     839    //TRACE: printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY);
     840    psS32 orderX = (trans1->nX + trans2->nX) - 1;
     841    psS32 orderY = (trans1->nY + trans2->nY) - 1;
     842
     843    psDPolynomial2D *out = psDPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD);
     844    //TRACE: printf("Creating poly (%d, %d)\n", orderX, orderY);
     845    for (psS32 i = 0 ; i < out->nX; i++) {
     846        for (psS32 j = 0 ; j < out->nY; j++) {
     847            out->coeff[i][j] = 0.0;
     848            out->mask[i][j] = 0;
     849        }
     850    }
     851
     852    for (psS32 t1x = 0 ; t1x < trans1->nX ; t1x++) {
     853        for (psS32 t1y = 0 ; t1y < trans1->nY ; t1y++) {
     854            if (0.0 != trans1->coeff[t1x][t1y]) {
     855                for (psS32 t2x = 0 ; t2x < trans2->nX ; t2x++) {
     856                    for (psS32 t2y = 0 ; t2y < trans2->nY ; t2y++) {
     857                        /* VERIFY MACRO
     858                        if ((t1x+t2x) >= orderX)
     859                            printf("CRAP 1\n");
     860                        if ((t1y+t2y) >= orderY)
     861                            printf("CRAP 2\n");
     862                        */
     863                        out->coeff[t1x+t2x][t1y+t2y]+= (trans1->coeff[t1x][t1y] * trans2->coeff[t2x][t2y]);
     864                    }
     865                }
     866            }
     867        }
     868    }
     869    return(out);
     870}
    863871
    864872
     
    875883    PS_PTR_CHECK_NULL(trans1, NULL);
    876884    PS_PTR_CHECK_NULL(trans2, NULL);
    877 
     885    //TRACE: printf("psPlaneTransformCombine(%d, %d, %d, %d: %d, %d, %d, %d)\n", trans1->x->nX, trans1->x->nY, trans1->y->nX, trans1->y->nY, trans2->x->nX, trans2->x->nY, trans2->y->nX, trans2->y->nY);
    878886    //
    879887    // Determine the size of the new psPlaneTransform.
     
    930938    // multiplied against themselves.  This can easily be improved.
    931939    //
     940
    932941    for (psS32 t2x = 0 ; t2x < trans2->x->nX ; t2x++) {
    933942        for (psS32 t2y = 0 ; t2y < trans2->x->nY ; t2y++) {
    934943            psDPolynomial2D *currPoly = psDPolynomial2DAlloc(1, 1, PS_POLYNOMIAL_ORD);
     944
    935945            currPoly->coeff[0][0] = 1.0;
    936946            currPoly->mask[0][0] = 0;
     
    938948
    939949            if (trans2->x->mask[t2x][t2y] == 0) {
    940 
    941950                // Must raise trans1->y to the t2y-power.
    942951                for (psS32 c = 0 ; c < t2y; c++) {
     
    965974
    966975
    967 
    968976    for (psS32 t2x = 0 ; t2x < trans2->y->nX ; t2x++) {
    969977        for (psS32 t2y = 0 ; t2y < trans2->y->nY ; t2y++) {
     
    10001008    }
    10011009
     1010    //TRACE: printf("Exiting combine()\n");
    10021011    return(myPT);
    10031012}
Note: See TracChangeset for help on using the changeset viewer.