IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5576


Ignore:
Timestamp:
Nov 22, 2005, 11:40:40 AM (20 years ago)
Author:
gusciora
Message:

....

Location:
trunk/psLib/src
Files:
3 edited

Legend:

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

    r5544 r5576  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.90 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-11-18 19:46:09 $
     12*  @version $Revision: 1.91 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-11-22 21:40:40 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    140140    true: if linear
    141141    false: otherwise
     142 
     143Why isn't this called p_psIsPlaneTransformLinear()?
    142144 *****************************************************************************/
    143145psBool p_psIsProjectionLinear(psPlaneTransform *transform)
     
    324326XXX: Private Function.
    325327 
    326 piNormalize(): take an input angle in radians and convert it to the range 0:2*PI.
     328piNormalize(): take an input angle in radians and convert it to the range
     3290:2*PI.
    327330 *****************************************************************************/
    328331psF32 piNormalize(psF32 angle)
     
    454457
    455458    // Remove plate scales
    456     psF64  x = coord->x/projection->Xs;
    457     psF64  y = coord->y/projection->Ys;
     459    psF64  x = coord->x * projection->Xs;
     460    psF64  y = coord->y * projection->Ys;
    458461
    459462    // Perform inverse projection
     
    514517                                       psPolynomial2D *trans2)
    515518{
    516     //TRACE: printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY);
     519    printf("multiplyDPoly2D(%d %d: %d %d)\n", trans1->nX, trans1->nY, trans2->nX, trans2->nY);
    517520    // XXX: OLD:  psS32 orderX = (trans1->nX + trans2->nX) - 1;
    518521    // XXX: Verify this (the poly order change)
    519     psS32 orderX = trans1->nX + trans2->nX + 1;
    520     psS32 orderY = trans1->nY + trans2->nY + 1;
     522    psS32 orderX = trans1->nX + trans2->nX;
     523    psS32 orderY = trans1->nY + trans2->nY;
     524    printf("out poly (nX, nY) is (%d, %d)\n", orderX, orderY);
    521525
    522526    // XXX: Verify this (the poly order change)
    523     psPolynomial2D *out = psPolynomial2DAlloc(orderX-1, orderY-1, PS_POLYNOMIAL_ORD);
     527    psPolynomial2D *out = psPolynomial2DAlloc(orderX, orderY, PS_POLYNOMIAL_ORD);
    524528    //TRACE: printf("Creating poly (%d, %d)\n", orderX, orderY);
    525     for (psS32 i = 0 ; i < (1 + out->nX); i++) {
    526         for (psS32 j = 0 ; j < (1 + out->nY); j++) {
    527             out->coeff[i][j] = 0.0;
    528             out->mask[i][j] = 0;
    529         }
    530     }
    531529
    532530    for (psS32 t1x = 0 ; t1x < (1 + trans1->nX) ; t1x++) {
     
    557555routine far too many times.
    558556 *****************************************************************************/
    559 psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
    560         const psPlaneTransform *trans1,
    561         const psPlaneTransform *trans2,
    562         psRegion region,
    563         int nSamples)
     557psPlaneTransform *psPlaneTransformCombine(
     558    psPlaneTransform *out,
     559    const psPlaneTransform *trans1,
     560    const psPlaneTransform *trans2,
     561    psRegion region,
     562    int nSamples)
    564563{
    565564    PS_ASSERT_PTR_NON_NULL(trans1, NULL);
    566565    PS_ASSERT_PTR_NON_NULL(trans2, NULL);
    567     //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->COOL_2D_nX, trans2->x->COOL_2D_nY, trans2->y->COOL_2D_nX, trans2->y->COOL_2D_nY);
     566    printf("-------------------------------------------------------------------------------\n");
     567    printf("psPlaneTransformCombine(%d, %d) (%d, %d) (%d, %d) (%d, %d)\n",
     568           trans1->x->nX, trans1->x->nY, trans1->y->nX, trans1->y->nY,
     569           trans2->x->nX, trans2->x->nY, trans2->y->nX, trans2->y->nY);
     570    printf("trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY);
     571    printf("trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY);
     572    printf("trans2->x is (%d, %d) order.\n", trans2->x->nX, trans2->x->nY);
     573    printf("trans2->y is (%d, %d) order.\n", trans2->y->nX, trans2->y->nY);
    568574    //
    569575    // Determine the size of the new psPlaneTransform.
    570576    //
    571     // PS_MAX(  Number of x terms in T2->x * number of x terms in T1->x,
    572     //          Number of y terms in T2->x * number of x terms in T1->y,
    573     psS32 orderXnX = PS_MAX(((1 + trans2->x->nX) * (1 + trans1->x->nX)),
    574                             ((1 + trans2->x->nY) * (1 + trans1->y->nX)));
    575     psS32 orderXnY = PS_MAX(((1 + trans2->x->nX) * (1 + trans1->x->nY)),
    576                             ((1 + trans2->x->nY) * (1 + trans1->y->nY)));
    577 
    578     psS32 orderYnX = PS_MAX(((1 + trans2->y->nX) * (1 + trans1->x->nX)),
    579                             ((1 + trans2->y->nY) * (1 + trans1->y->nX)));
    580     psS32 orderYnY = PS_MAX(((1 + trans2->y->nX) * (1 + trans1->x->nY)),
    581                             ((1 + trans2->y->nY) * (1 + trans1->y->nY)));
     577    psS32 orderXnX = PS_MAX((trans2->x->nX * trans1->x->nX),
     578                            (trans2->x->nY * trans1->y->nX));
     579    psS32 orderXnY = PS_MAX((trans2->x->nX * trans1->x->nY),
     580                            (trans2->x->nY * trans1->y->nY));
     581
     582    psS32 orderYnX = PS_MAX((trans2->y->nX * trans1->x->nX),
     583                            (trans2->y->nY * trans1->y->nX));
     584    psS32 orderYnY = PS_MAX((trans2->y->nX * trans1->x->nY),
     585                            (trans2->y->nY * trans1->y->nY));
    582586    psS32 orderX = PS_MAX(orderXnX, orderYnX);
    583587    psS32 orderY = PS_MAX(orderXnY, orderYnY);
     588    printf("OLD (orderX, orderY) is (%d, %d)\n", orderX, orderY);
     589
     590    orderXnX = (trans2->x->nX * trans1->x->nX) + (trans2->x->nY * trans1->y->nX);
     591    orderXnY = (trans2->x->nX * trans1->x->nY) + (trans2->x->nY * trans1->y->nY);
     592    orderYnX = (trans2->y->nX * trans1->x->nX) + (trans2->y->nY * trans1->y->nX);
     593    orderYnY = (trans2->y->nX * trans1->x->nY) + (trans2->y->nY * trans1->y->nY);
     594    orderX = PS_MAX(orderXnX, orderYnX);
     595    orderY = PS_MAX(orderXnY, orderYnY);
     596    printf("(orderX, orderY) is (%d, %d)\n", orderX, orderY);
     597
    584598
    585599    //
     
    591605        myPT = psPlaneTransformAlloc(orderX, orderY);
    592606    } else {
    593         if (((1 + out->x->nX) == orderX) && ((1 + out->x->nY) == orderY) &&
    594                 ((1 + out->y->nX) == orderX) && ((1 + out->y->nY) == orderY)) {
     607        if ((out->x->nX == orderX) &&
     608                (out->x->nY == orderY) &&
     609                (out->y->nX == orderX) &&
     610                (out->y->nY == orderY)) {
    595611            myPT = out;
     612            //
     613            // Initialize the new psPlaneTransform, if necessary.
     614            //
     615            for (psS32 i = 0 ; i < orderX ; i++) {
     616                for (psS32 j = 0 ; j < orderY ; j++) {
     617                    myPT->x->coeff[i][j] = 0.0;
     618                    myPT->x->mask[i][j] = 0;
     619                    myPT->y->coeff[i][j] = 0.0;
     620                    myPT->y->mask[i][j] = 0;
     621                }
     622            }
    596623        } else {
    597624            psFree(out);
     
    599626        }
    600627    }
    601 
    602     //
    603     // Initialize the new psPlaneTransform, if necessary.
    604     //
    605     for (psS32 i = 0 ; i < orderX ; i++) {
    606         for (psS32 j = 0 ; j < orderY ; j++) {
    607             myPT->x->coeff[i][j] = 0.0;
    608             myPT->x->mask[i][j] = 0;
    609             myPT->y->coeff[i][j] = 0.0;
    610             myPT->y->mask[i][j] = 0;
    611         }
    612     }
     628    printf("New polynomial is (%d %d %d %d)\n", myPT->x->nX, myPT->x->nY, myPT->y->nX, myPT->y->nY);
    613629
    614630    //
     
    624640    for (psS32 t2x = 0 ; t2x < (1 + trans2->x->nX) ; t2x++) {
    625641        for (psS32 t2y = 0 ; t2y < (1 + trans2->x->nX) ; t2y++) {
     642            printf("-------------------- (t2x, t2y) (%d, %d) --------------------\n", t2x, t2y);
    626643            // XXX: Verify this (poly order/nterm change)
    627             psPolynomial2D *currPoly = psPolynomial2DAlloc(1-1, 1-1, PS_POLYNOMIAL_ORD);
     644            psPolynomial2D *currPoly = psPolynomial2DAlloc(0, 0, PS_POLYNOMIAL_ORD);
    628645
    629646            currPoly->coeff[0][0] = 1.0;
     
    632649
    633650            if (trans2->x->mask[t2x][t2y] == 0) {
    634                 // Must raise trans1->y to the t2y-power.
    635                 for (psS32 c = 0 ; c < t2y; c++) {
     651                // Must raise trans1->y to the (t2y-1)-power.
     652                for (psS32 c = 0 ; c < t2y-1; c++) {
    636653                    newPoly = multiplyDPoly2D(currPoly, trans1->y);
    637654                    psFree(currPoly);
     
    639656                }
    640657
    641                 // Must raise trans1->x to the t2x-power.
    642                 for (psS32 c = 0 ; c < t2x; c++) {
     658                // Must raise trans1->x to the (t2x-1)-power.
     659                for (psS32 c = 0 ; c < t2x-1; c++) {
    643660                    newPoly = multiplyDPoly2D(currPoly, trans1->x);
    644661                    psFree(currPoly);
    645662                    currPoly = newPoly;
    646663                }
    647 
     664                printf("trans1->x is (%d, %d) order.\n", trans1->x->nX, trans1->x->nY);
     665                printf("trans1->x was raised to the %d power.\n", t2x);
     666                printf("trans1->y is (%d, %d) order.\n", trans1->y->nX, trans1->y->nY);
     667                printf("trans1->y was raised to the %d power.\n", t2y);
     668                printf("HERE 00\n");
     669                printf("HEY (%d, %d) (%d, %d)\n", myPT->x->nX, myPT->x->nY, currPoly->nX, currPoly->nY);
    648670                // Set the appropriate coeffs in myPT->x
    649671                for (psS32 i = 0 ; i < (1 + currPoly->nX) ; i++) {
    650672                    for (psS32 j = 0 ; j < (1 + currPoly->nY) ; j++) {
     673                        //                        printf("    HMMM (%d, %d)\n", i, j);
    651674                        myPT->x->coeff[i][j]+= currPoly->coeff[i][j] * trans2->x->coeff[t2x][t2y];
    652675                    }
    653676                }
     677                printf("HERE 01\n");
    654678            }
    655679            psFree(currPoly);
  • trunk/psLib/src/math/psPolynomial.c

    r5542 r5576  
    77*  polynomials.  It also contains a Gaussian functions.
    88*
    9 *  @version $Revision: 1.131 $ $Name: not supported by cvs2svn $
    10 *  @date $Date: 2005-11-18 19:39:29 $
     9*  @version $Revision: 1.132 $ $Name: not supported by cvs2svn $
     10*  @date $Date: 2005-11-22 21:40:40 $
    1111*
    1212*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    725725}
    726726
    727 psPolynomial4D* psPolynomial4DAlloc( unsigned int nX,
    728                                      unsigned int nY,
    729                                      unsigned int nZ,
    730                                      unsigned int nT,
    731                                      psPolynomialType type)
     727psPolynomial4D* psPolynomial4DAlloc(
     728    unsigned int nX,
     729    unsigned int nY,
     730    unsigned int nZ,
     731    unsigned int nT,
     732    psPolynomialType type)
    732733{
    733734    PS_ASSERT_INT_NONNEGATIVE(nX, NULL);
  • trunk/psLib/src/math/psStats.c

    r5563 r5576  
    1717*
    1818*
    19 *  @version $Revision: 1.153 $ $Name: not supported by cvs2svn $
    20 *  @date $Date: 2005-11-22 01:18:13 $
     19*  @version $Revision: 1.154 $ $Name: not supported by cvs2svn $
     20*  @date $Date: 2005-11-22 21:40:40 $
    2121*
    2222*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
Note: See TracChangeset for help on using the changeset viewer.