IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 3714 for trunk/psLib/src


Ignore:
Timestamp:
Apr 18, 2005, 6:16:02 PM (21 years ago)
Author:
gusciora
Message:

Created tests for inverting linear psPlaneTransforms. Fixed a bug with the
linear transform inversion code.

Location:
trunk/psLib/src
Files:
7 edited

Legend:

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

    r3711 r3714  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-04-19 01:22:59 $
     12*  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-04-19 04:16:02 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484 X1 = (-D + ((F*A)/C)) / (E - ((F*B)/C)) +
    8585      (X2 * -((F/C) / (E - ((F*B)/C)))) +
    86              (Y2 * (1.0 / (E - ((F*B)/C))));
    87         Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +
    88              (X2 * -((E/B) / (F - ((C*E)/B)))) +
    89              (Y2 * (1.0 / (F - ((C*E)/B))));
     86      (Y2 * (1.0 / (E - ((F*B)/C))));
     87 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +
     88      (X2 * -((E/B) / (F - ((C*E)/B)))) +
     89      (Y2 * (1.0 / (F - ((C*E)/B))));
    9090 
    9191XXX: Since thre is now a general psPlaneTransformInvert() function, we
    9292should rename this.
     93 
     94X1, Y1 = (2, 3)
     95 
     96    X2 = 1 + 4 + 9   = 14
     97    Y2 = 4 + 10 + 18 = 32
     98 
     99in inverse
     100 
     101Y1 = (32 - ((5/2) * 14) - 4 + ((5)/2)) / (6 - ((15)/2));
     102Y1 = (32 - 35 - 4 + (5/2)) / (6 - 15/2);
     103Y1 = (-7 + (5/2)) / (12/2 - 15/2);
     104Y1 = (-7 + (5/2)) / (-3/2);
     105Y1 = (-14/2 + 5/2) / (-3/2);
     106Y1 = (-9/2) / (-3/2);
     107Y1 = (9/2) / (3/2);
     108Y1 = 3
     109 
     110X1 = (Y2 - ((F/C) * X2) - D + ((F*A)/C)) / (E - ((F*B)/C));
     111X1 = (32 - ((6/3) * 14) - 4 + ((6)/3)) / (5 - ((12)/3));
     112X1 = (32 - (2 * 14) - 4 + 2 / (5 - 4);
     113X1 = (32 - 28 - 4 + 2) / 1;
     114X1 = 2;
    93115 
    94116 *****************************************************************************/
     
    125147    psPlaneTransform *out = psPlaneTransformAlloc(2, 2);
    126148
    127     out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));
     149    out->x->coeff[0][0] = (-D + ((F*A)/C)) / (E - ((F*B)/C));
    128150    out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C));
    129151    out->x->coeff[0][1] =  1.0 / (E - ((F*B)/C));
    130     out->y->coeff[0][0] = -D + ((E*A)/B) / (F - ((C*E)/B));
     152    out->y->coeff[0][0] = (-D + ((E*A)/B)) / (F - ((C*E)/B));
    131153    out->y->coeff[1][0] = -(E/B) / (F - ((C*E)/B));
    132154    out->y->coeff[0][1] =  1.0 / (F - ((C*E)/B));
     
    11401162    //
    11411163    if (p_psIsProjectionLinear((psPlaneTransform *) in)) {
    1142         printf("COOL: is linear\n");
    11431164        return(p_psPlaneTransformLinearInvert((psPlaneTransform *) in));
    11441165    }
  • trunk/psLib/src/astronomy/psCoord.c

    r3711 r3714  
    1010*  @author GLG, MHPCC
    1111*
    12 *  @version $Revision: 1.63 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2005-04-19 01:22:59 $
     12*  @version $Revision: 1.64 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2005-04-19 04:16:02 $
    1414*
    1515*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    8484 X1 = (-D + ((F*A)/C)) / (E - ((F*B)/C)) +
    8585      (X2 * -((F/C) / (E - ((F*B)/C)))) +
    86              (Y2 * (1.0 / (E - ((F*B)/C))));
    87         Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +
    88              (X2 * -((E/B) / (F - ((C*E)/B)))) +
    89              (Y2 * (1.0 / (F - ((C*E)/B))));
     86      (Y2 * (1.0 / (E - ((F*B)/C))));
     87 Y1 = (-D + ((E*A)/B))/(F - ((C*E)/B)) +
     88      (X2 * -((E/B) / (F - ((C*E)/B)))) +
     89      (Y2 * (1.0 / (F - ((C*E)/B))));
    9090 
    9191XXX: Since thre is now a general psPlaneTransformInvert() function, we
    9292should rename this.
     93 
     94X1, Y1 = (2, 3)
     95 
     96    X2 = 1 + 4 + 9   = 14
     97    Y2 = 4 + 10 + 18 = 32
     98 
     99in inverse
     100 
     101Y1 = (32 - ((5/2) * 14) - 4 + ((5)/2)) / (6 - ((15)/2));
     102Y1 = (32 - 35 - 4 + (5/2)) / (6 - 15/2);
     103Y1 = (-7 + (5/2)) / (12/2 - 15/2);
     104Y1 = (-7 + (5/2)) / (-3/2);
     105Y1 = (-14/2 + 5/2) / (-3/2);
     106Y1 = (-9/2) / (-3/2);
     107Y1 = (9/2) / (3/2);
     108Y1 = 3
     109 
     110X1 = (Y2 - ((F/C) * X2) - D + ((F*A)/C)) / (E - ((F*B)/C));
     111X1 = (32 - ((6/3) * 14) - 4 + ((6)/3)) / (5 - ((12)/3));
     112X1 = (32 - (2 * 14) - 4 + 2 / (5 - 4);
     113X1 = (32 - 28 - 4 + 2) / 1;
     114X1 = 2;
    93115 
    94116 *****************************************************************************/
     
    125147    psPlaneTransform *out = psPlaneTransformAlloc(2, 2);
    126148
    127     out->x->coeff[0][0] = -D + ((F*A)/C) / (E - ((F*B)/C));
     149    out->x->coeff[0][0] = (-D + ((F*A)/C)) / (E - ((F*B)/C));
    128150    out->x->coeff[1][0] = -(F/C) / (E - ((F*B)/C));
    129151    out->x->coeff[0][1] =  1.0 / (E - ((F*B)/C));
    130     out->y->coeff[0][0] = -D + ((E*A)/B) / (F - ((C*E)/B));
     152    out->y->coeff[0][0] = (-D + ((E*A)/B)) / (F - ((C*E)/B));
    131153    out->y->coeff[1][0] = -(E/B) / (F - ((C*E)/B));
    132154    out->y->coeff[0][1] =  1.0 / (F - ((C*E)/B));
     
    11401162    //
    11411163    if (p_psIsProjectionLinear((psPlaneTransform *) in)) {
    1142         printf("COOL: is linear\n");
    11431164        return(p_psPlaneTransformLinearInvert((psPlaneTransform *) in));
    11441165    }
  • trunk/psLib/src/dataManip/psFunctions.c

    r3709 r3714  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.97 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-04-19 00:34:04 $
     9 *  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-04-19 04:16:02 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1313 *
    14  *  XXX: What happens if the polyEVal functions are called with data of the wrong
     14 *  XXX: What happens if the polyEval functions are called with data of the wrong
    1515 *       type?
    1616 *  XXX: Should the "coeffErr[]" be used as well?  Bug ???.  Ignore coeffErr
    1717 *
     18 *  XXX: In the various polyAlloc(n) functions, n is really the order of the
     19 *  polynomial plus 1.  To create a 2nd-order polynomial, n == 3.
    1820 */
    1921/*****************************************************************************/
     
    175177static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    176178{
    177     psS32 x = 0;
    178 
    179     for (x = 0; x < myPoly->nX; x++) {
     179    //printf("dPolynomial2DFree(): HMMM: myPoly->nX is %d\n", myPoly->nX);
     180    //printf("dPolynomial2DFree(): HMMM: myPoly->nY is %d\n", myPoly->nY);
     181    for (psS32 x = 0; x < myPoly->nX; x++) {
    180182        psFree(myPoly->coeff[x]);
    181183        psFree(myPoly->coeffErr[x]);
  • trunk/psLib/src/image/psImageStats.c

    r3684 r3714  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-08 17:58:57 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-04-19 04:16:02 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4040 
    4141XXX: use static psVectors
     42 
     43XXX: optimize this.  2k vs 4k, sample mean, takes8 seconds on Gene's machine.
     44Should take .2.
    4245 *****************************************************************************/
    4346psStats* psImageStats(psStats* stats,
  • trunk/psLib/src/imageops/psImageStats.c

    r3684 r3714  
    99 *  @author GLG, MHPCC
    1010 *
    11  *  @version $Revision: 1.71 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-04-08 17:58:57 $
     11 *  @version $Revision: 1.72 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-04-19 04:16:02 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4040 
    4141XXX: use static psVectors
     42 
     43XXX: optimize this.  2k vs 4k, sample mean, takes8 seconds on Gene's machine.
     44Should take .2.
    4245 *****************************************************************************/
    4346psStats* psImageStats(psStats* stats,
  • trunk/psLib/src/math/psPolynomial.c

    r3709 r3714  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.97 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-04-19 00:34:04 $
     9 *  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-04-19 04:16:02 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1313 *
    14  *  XXX: What happens if the polyEVal functions are called with data of the wrong
     14 *  XXX: What happens if the polyEval functions are called with data of the wrong
    1515 *       type?
    1616 *  XXX: Should the "coeffErr[]" be used as well?  Bug ???.  Ignore coeffErr
    1717 *
     18 *  XXX: In the various polyAlloc(n) functions, n is really the order of the
     19 *  polynomial plus 1.  To create a 2nd-order polynomial, n == 3.
    1820 */
    1921/*****************************************************************************/
     
    175177static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    176178{
    177     psS32 x = 0;
    178 
    179     for (x = 0; x < myPoly->nX; x++) {
     179    //printf("dPolynomial2DFree(): HMMM: myPoly->nX is %d\n", myPoly->nX);
     180    //printf("dPolynomial2DFree(): HMMM: myPoly->nY is %d\n", myPoly->nY);
     181    for (psS32 x = 0; x < myPoly->nX; x++) {
    180182        psFree(myPoly->coeff[x]);
    181183        psFree(myPoly->coeffErr[x]);
  • trunk/psLib/src/math/psSpline.c

    r3709 r3714  
    77 *  polynomials.  It also contains a Gaussian functions.
    88 *
    9  *  @version $Revision: 1.97 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-04-19 00:34:04 $
     9 *  @version $Revision: 1.98 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-04-19 04:16:02 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
    1313 *
    14  *  XXX: What happens if the polyEVal functions are called with data of the wrong
     14 *  XXX: What happens if the polyEval functions are called with data of the wrong
    1515 *       type?
    1616 *  XXX: Should the "coeffErr[]" be used as well?  Bug ???.  Ignore coeffErr
    1717 *
     18 *  XXX: In the various polyAlloc(n) functions, n is really the order of the
     19 *  polynomial plus 1.  To create a 2nd-order polynomial, n == 3.
    1820 */
    1921/*****************************************************************************/
     
    175177static void dPolynomial2DFree(psDPolynomial2D* myPoly)
    176178{
    177     psS32 x = 0;
    178 
    179     for (x = 0; x < myPoly->nX; x++) {
     179    //printf("dPolynomial2DFree(): HMMM: myPoly->nX is %d\n", myPoly->nX);
     180    //printf("dPolynomial2DFree(): HMMM: myPoly->nY is %d\n", myPoly->nY);
     181    for (psS32 x = 0; x < myPoly->nX; x++) {
    180182        psFree(myPoly->coeff[x]);
    181183        psFree(myPoly->coeffErr[x]);
Note: See TracChangeset for help on using the changeset viewer.