IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 19, 2005, 1:57:37 PM (21 years ago)
Author:
gusciora
Message:

...

File:
1 edited

Legend:

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

    r3977 r3990  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.67 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-05-19 05:18:20 $
     12*  @version $Revision: 1.68 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-05-19 23:57:36 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8989      (Y2 * (1.0 / (F - ((C*E)/B))));
    9090 
    91 XXX: Since thre is now a general psPlaneTransformInvert() function, we
     91XXX: Since there is now a general psPlaneTransformInvert() function, we
    9292should rename this.
    9393 *****************************************************************************/
     
    122122    psPlaneTransform *out = psPlaneTransformAlloc(2, 2);
    123123
     124    /* This is sample code from IfA.  It didn't work initially, and I did not
     125       spend any time debugging it.
     126     
     127        psF64 a = transform->x->coeff[1][0];
     128        psF64 b = transform->x->coeff[0][1];
     129        psF64 c = transform->y->coeff[1][0];
     130        psF64 d = transform->y->coeff[0][1];
     131        psF64 e = transform->x->coeff[0][0];
     132        psF64 f = transform->y->coeff[0][0];
     133     
     134        psF64 invDet = 1.0 / (a * d - b * c); // Inverse of the determinant
     135     
     136        // Not entirely sure why this works, but it appears to do so....................................!
     137        out->x->coeff[1][0] = invDet * a;
     138        out->x->coeff[0][1] = - invDet * b;
     139        out->y->coeff[1][0] = - invDet * c;
     140        out->y->coeff[0][1] = invDet * d;
     141     
     142        out->x->coeff[0][0] = - invDet * (d * e + c * f);
     143        out->y->coeff[0][0] = - invDet * (b * e + a * f);
     144    */
    124145    out->x->coeff[0][0] = (-D + ((F*A)/C)) / (E - ((F*B)/C));
    125146    out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C));
     
    10321053    psS32 numCoords = PS_MIN(source->n, dest->n);
    10331054    psS32 order = PS_MAX(trans->x->nX, trans->x->nY);
     1055    order = PS_MAX(order, trans->y->nX);
     1056    order = PS_MAX(order, trans->y->nY);
    10341057
    10351058    //
     
    11331156psPlaneTransform *psPlaneTransformInvert(psPlaneTransform *out,
    11341157        const psPlaneTransform *in,
    1135         psRegion region,
     1158        psRegion *region,
    11361159        int nSamples)
    11371160{
     
    11511174        psError(PS_ERR_BAD_PARAMETER_TYPE, true, "Input transformation must have same nX==nY.");
    11521175    }
    1153     psS32 order = PS_MAX(in->x->nX, in->x->nY);
     1176    psS32 order = in->x->nX;
    11541177
    11551178    psPlaneTransform *myPT = NULL;
     
    11971220
    11981221    //
    1199     // Initialize the grid.
     1222    // Initialize the grid.  Since we want the inverse of the transformation, the
     1223    // inCoords are written to the outData vector, and the outCoords are written
     1224    // to the inData vector.
    12001225    //
    12011226    psS32 cnt = 0;
     
    12051230            inCoord->x = region.x0 + ((psF32) xint) * ((region.x1 - region.x0) / ((psF32) nSamples));
    12061231            (void)psPlaneTransformApply(outCoord, in, inCoord);
    1207 
    12081232            ((psPlane *) outData->data[cnt])->x = inCoord->x;
    12091233            ((psPlane *) outData->data[cnt])->y = inCoord->y;
     
    12141238        }
    12151239    }
     1240    // XXX: what values should be used here?
    12161241    bool rc = psPlaneTransformFit(myPT, inData, outData, 10, 100.0);
    12171242
Note: See TracChangeset for help on using the changeset viewer.