IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 11, 2005, 12:18:40 PM (21 years ago)
Author:
gusciora
Message:

....

File:
1 edited

Legend:

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

    r4957 r4991  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.85 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-09-07 21:33:48 $
     12*  @version $Revision: 1.86 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-09-11 22:18:40 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    545545        int nSamples)
    546546{
    547 
    548     // XXX: This does not yet use region and nSamples:  need to modify -rdd
    549 
    550547    PS_ASSERT_PTR_NON_NULL(trans1, NULL);
    551548    PS_ASSERT_PTR_NON_NULL(trans2, NULL);
     
    905902)
    906903{
    907     /*
    908         PS_ASSERT_PTR_NON_NULL(transformation, NULL);
    909         PS_ASSERT_POLY_NON_NULL(transformation->x, NULL);
    910         PS_ASSERT_POLY_NON_NULL(transformation->y, NULL);
    911         PS_ASSERT_PTR_NON_NULL(coord, NULL);
    912      
    913         if (out == NULL) {
    914             out = psPlaneAlloc();
    915         }
    916      
    917         out->x = 0.0;
    918         out->y = 0.0;
    919         out->xErr = 0.0;
    920         out->yErr = 0.0;
    921      
    922         psPolynomial2D *xPoly = transformation->x;
    923         psPolynomial2D *yPoly = transformation->y;
    924      
    925         //
    926         // Calculate the derivative with respect to x.
    927         //
    928         psF32 xSum = 1.0;
    929         psF32 ySum = 1.0;
    930      
    931         // This loop starts at loop_x=1 since the derivative of the loop_x=0 terms are all 0.0
    932         for (psS32 loop_x = 1; loop_x < xPoly->nX; loop_x++) {
    933             ySum = 1.0;
    934             for (psS32 loop_y = 0; loop_y < xPoly->nY; loop_y++) {
    935                 //
    936                 // For each iteration of the loop, we multiple the (x, y) coefficient
    937                 // by (coord->x^(loop_x-1) * coord->y^loop_y)
    938                 //
    939      
    940                 out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum;
    941                 ySum*= coord->y;
    942             }
    943             xSum*= coord->x;
    944         }
    945      
    946         //
    947         // Calculate the derivative with respect to x.
    948         //
    949         xSum = 1.0;
    950      
    951         // This loop starts at loop_y=1 since the derivative of the loop_y=0 terms are all 0.0
    952         for (psS32 loop_x = 0; loop_x < yPoly->nX; loop_x++) {
    953             ySum = 1.0;
    954             for (psS32 loop_y = 1; loop_y < yPoly->nY; loop_y++) {
    955                 //
    956                 // For each iteration of the loop, we multiple the (x, y) coefficient
    957                 // by (coord->x^(loop_x-1) * coord->y^loop_y)
    958                 //
    959      
    960                 out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum;
    961                 ySum*= coord->y;
    962             }
    963             xSum*= coord->x;
    964         }
    965     */
     904    PS_ASSERT_PTR_NON_NULL(transformation, NULL);
     905    PS_ASSERT_POLY_NON_NULL(transformation->x, NULL);
     906    PS_ASSERT_POLY_NON_NULL(transformation->y, NULL);
     907    PS_ASSERT_PTR_NON_NULL(coord, NULL);
     908
     909    if (out == NULL) {
     910        out = psPlaneAlloc();
     911    }
     912
     913    out->x = 0.0;
     914    out->y = 0.0;
     915    out->xErr = 0.0;
     916    out->yErr = 0.0;
     917
     918    psPolynomial2D *xPoly = transformation->x;
     919    psPolynomial2D *yPoly = transformation->y;
     920
     921    //
     922    // Calculate the derivative with respect to x.
     923    //
     924    psF32 xSum = 1.0;
     925    psF32 ySum = 1.0;
     926
     927    // This loop starts at loop_x=1 since the derivative of the loop_x=0 terms are all 0.0
     928    for (psS32 loop_x = 1; loop_x < xPoly->nX; loop_x++) {
     929        ySum = 1.0;
     930        for (psS32 loop_y = 0; loop_y < xPoly->nY; loop_y++) {
     931            //
     932            // For each iteration of the loop, we multiple the (x, y) coefficient
     933            // by (coord->x^(loop_x-1) * coord->y^loop_y)
     934            //
     935
     936            out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum;
     937            ySum*= coord->y;
     938        }
     939        xSum*= coord->x;
     940    }
     941
     942    //
     943    // Calculate the derivative with respect to x.
     944    //
     945    xSum = 1.0;
     946
     947    // This loop starts at loop_y=1 since the derivative of the loop_y=0 terms are all 0.0
     948    for (psS32 loop_x = 0; loop_x < yPoly->nX; loop_x++) {
     949        ySum = 1.0;
     950        for (psS32 loop_y = 1; loop_y < yPoly->nY; loop_y++) {
     951            //
     952            // For each iteration of the loop, we multiple the (x, y) coefficient
     953            // by (coord->x^(loop_x-1) * coord->y^loop_y)
     954            //
     955
     956            out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum;
     957            ySum*= coord->y;
     958        }
     959        xSum*= coord->x;
     960    }
    966961    return(out);
    967962}
     
    970965{
    971966    if(sphere == NULL) {
    972         //        psError();
     967        psError( PS_ERR_UNKNOWN, true, "psSphere argument is NULL.  Returning NULL.\n");
    973968        return NULL;
    974969    }
     
    990985{
    991986    if(cube == NULL) {
    992         //        psError();
     987        psError( PS_ERR_UNKNOWN, true, "psCube argument is NULL.  Returning NULL.\n");
    993988        return NULL;
    994989    }
Note: See TracChangeset for help on using the changeset viewer.