IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 13, 2005, 10:23:57 AM (21 years ago)
Author:
drobbin
Message:

Fixed psSphereRotAlloc and test. Correctly verified calculations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astro/tst_psSphereOps.c

    r5254 r5306  
    66*  @author GLG, MHPCC
    77*
    8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9 *  @date $Date: 2005-10-08 03:51:20 $
     8*  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     9*  @date $Date: 2005-10-13 20:23:57 $
    1010*
    1111*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    4848#define ERROR_TOL   0.0001
    4949
    50 #define ALPHA_P 0.5 * M_PI
    51 #define DELTA_P 1.0 * M_PI
    52 #define PHI_P 1.5 * M_PI
     50#define ALPHA_P M_PI/6
     51#define DELTA_P M_PI/4
     52#define PHI_P M_PI/2
    5353
    5454psS32 testSphereRotAlloc( void )
     
    6262        return 1;
    6363    }
    64     // Verify sin member is updated
    65     double vx = cos(DELTA_P)*cos(ALPHA_P);
    66     double vy = cos(DELTA_P)*sin(ALPHA_P);
    67     double vz = sin(DELTA_P);
    68     double q0 = vx * sin(PHI_P/2.0);
    69     double q1 = vy * sin(PHI_P/2.0);
    70     double q2 = vz * sin(PHI_P/2.0);
    71     double q3 = cos(PHI_P/2.0);
    72     double len = sqrt(q0*q0 + q1*q1 + q2*q2 + q3*q3);
    73     printf("\nvz = %lf\n", vz);
    74     q0 = q0/len;
    75     q1 = q1/len;
    76     q2 = q2/len;
    77     q3 = q3/len;
    78 
     64
     65    double a0 = (ALPHA_P - PHI_P)/2.0;
     66    double a1 = (ALPHA_P - PHI_P)/2.0;
     67    double a2 = (ALPHA_P + PHI_P)/2.0;
     68    double a3 = (ALPHA_P + PHI_P)/2.0;
     69
     70    double q3 = cos(a3)*cos(DELTA_P/2);
     71    double q0 = sin(a0)*sin(DELTA_P/2);
     72    double q1 = cos(a1)*sin(DELTA_P/2);
     73    double q2 = sin(a2)*cos(DELTA_P/2);
     74
     75    printf("\n q0=%lf, q1=%lf, q2=%lf, q3=%lf,\n", q0, q1, q2, q3);
     76    printf("myq0=%lf, myq1=%lf, myq2=%lf, myq3=%lf\n", myST->q0, myST->q1, myST->q2, myST->q3);
    7977    if (FLT_EPSILON < fabs(q0 - myST->q0)) {
    80         psError(PS_ERR_UNKNOWN,true,"myST->q0 is %f, should be %f\n", myST->q0, q0);
     78        psError(PS_ERR_UNKNOWN,true,"myST->q0 is %lf, should be %lf\n", myST->q0, q0);
    8179        return 2;
    8280    }
Note: See TracChangeset for help on using the changeset viewer.