IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 6254


Ignore:
Timestamp:
Jan 30, 2006, 1:42:24 PM (20 years ago)
Author:
gusciora
Message:

Fixed math error with the TransformDeriv function

File:
1 edited

Legend:

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

    r6253 r6254  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.104 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2006-01-30 22:56:01 $
     12*  @version $Revision: 1.105 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2006-01-30 23:42:24 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    206206
    207207// XXX: Verify the order/nterms poly changes
    208 psPlaneTransform* psPlaneTransformAlloc(int order1,
    209                                         int order2)
     208psPlaneTransform* psPlaneTransformAlloc(int order1, int order2)
    210209{
    211210    PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
     
    241240}
    242241
    243 psPlane* psPlaneTransformApply(psPlane* out,
    244                                const psPlaneTransform* transform,
    245                                const psPlane* coords)
     242psPlane* psPlaneTransformApply(
     243    psPlane* out,
     244    const psPlaneTransform* transform,
     245    const psPlane* coords)
    246246{
    247247    PS_ASSERT_PTR_NON_NULL(transform, NULL);
     
    267267
    268268// XXX: Verify the order/nterms poly changes
    269 psPlaneDistort* psPlaneDistortAlloc(int order1,
    270                                     int order2,
    271                                     int order3,
    272                                     int order4)
     269psPlaneDistort* psPlaneDistortAlloc(int order1, int order2, int order3, int order4)
    273270{
    274271    PS_ASSERT_INT_NONNEGATIVE(order1, NULL);
     
    350347}
    351348
    352 psProjection* psProjectionAlloc(double R,
    353                                 double D,
    354                                 double Xs,
    355                                 double Ys,
    356                                 psProjectionType type)
     349psProjection* psProjectionAlloc(
     350    double R,
     351    double D,
     352    double Xs,
     353    double Ys,
     354    psProjectionType type)
    357355{
    358356    psProjection *p = psAlloc(sizeof(psProjection));
     
    374372
    375373
    376 psPlane* p_psProject(psPlane *outPlane,
    377                      const psSphere* coord,
    378                      const psProjection* projection)
     374psPlane* p_psProject(
     375    psPlane *outPlane,
     376    const psSphere* coord,
     377    const psProjection* projection)
    379378{
    380379    PS_ASSERT_PTR_NON_NULL(coord, NULL);
     
    458457}
    459458
    460 psSphere* p_psDeproject(psSphere *outSphere,
    461                         const psPlane* coord,
    462                         const psProjection* projection)
     459psSphere* p_psDeproject(
     460    psSphere *outSphere,
     461    const psPlane* coord,
     462    const psProjection* projection)
    463463{
    464464    PS_ASSERT_PTR_NON_NULL(coord, NULL);
     
    604604routine far too many times.
    605605 *****************************************************************************/
    606 psPlaneTransform *psPlaneTransformCombine(psPlaneTransform *out,
    607         const psPlaneTransform *trans1,
    608         const psPlaneTransform *trans2,
    609         psRegion region,
    610         int nSamples)
     606psPlaneTransform *psPlaneTransformCombine(
     607    psPlaneTransform *out,
     608    const psPlaneTransform *trans1,
     609    const psPlaneTransform *trans2,
     610    psRegion region,
     611    int nSamples)
    611612{
    612613    psTrace(__func__, 3, "---- %s() begin ----\n", __func__);
     
    10151016}
    10161017
    1017 psPlane *psPlaneTransformDeriv(psPlane *out,
    1018                                const psPlaneTransform *transformation,
    1019                                const psPlane *coord)
     1018psPlane *psPlaneTransformDeriv(
     1019    psPlane *out,
     1020    const psPlaneTransform *transformation,
     1021    const psPlane *coord
     1022)
    10201023{
    10211024    PS_ASSERT_PTR_NON_NULL(transformation, NULL);
     
    10471050        for (psS32 loop_y = 0; loop_y < (1 + xPoly->nY); loop_y++) {
    10481051            //
    1049             // For each iteration of the loop, we multiple the (x, y) coefficient
    1050             // by (coord->x^(loop_x-1) * coord->y^loop_y)
     1052            // For each iteration of the loop, we multiply the (x, y) coefficient
     1053            // by (x^(loop_x-1) * y^loop_y) * loop_x
    10511054            //
    10521055
    1053             out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum;
     1056            out->x+= xPoly->coeff[loop_x][loop_y] * xSum * ySum * ((psF32) loop_x);
     1057            psTrace(__func__, 6, "out->x+= (%.2f * %.2f * %.2f * %.2f)\n", xPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_x));
    10541058            ySum*= coord->y;
    10551059        }
     
    10671071        for (psS32 loop_y = 1; loop_y < (1 + yPoly->nY); loop_y++) {
    10681072            //
    1069             // For each iteration of the loop, we multiple the (x, y) coefficient
    1070             // by (coord->x^(loop_x-1) * coord->y^loop_y)
     1073            // For each iteration of the loop, we multiply the (x, y) coefficient
     1074            // by (x^(loop_x-1) * y^loop_y) * loop_y
     1075            // by (x^(loop_x) * y^(loop_y-1))
    10711076            //
    10721077
    1073             out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum;
     1078            out->y+= yPoly->coeff[loop_x][loop_y] * xSum * ySum * ((psF32) loop_y);
     1079            psTrace(__func__, 6, "out->y+= (%.2f * %.2f * %.2f * %.2f)\n", yPoly->coeff[loop_x][loop_y], xSum, ySum, ((psF32) loop_y));
    10741080            ySum*= coord->y;
    10751081        }
    10761082        xSum*= coord->x;
    10771083    }
     1084
    10781085    return(out);
    10791086}
Note: See TracChangeset for help on using the changeset viewer.