IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 5749


Ignore:
Timestamp:
Dec 7, 2005, 4:49:04 PM (21 years ago)
Author:
drobbin
Message:

updated tests, got TEOtoCEO working and verified. Currently working on CEOtoGCRS.

Location:
trunk/psLib
Files:
2 edited

Legend:

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

    r5657 r5749  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.21 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-12-02 04:40:00 $
     10 *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-12-08 02:49:04 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    690690    //XXX: Used formula for rotation matrix D from mathworld for z-axis rotation
    691691    double a =  1.0 / (1.0 + sqrt(1.0 - (pole->x*pole->x + pole->y*pole->y) ) );
     692    /*    A[0][0] = (1.0 - a*pole->x*pole->x)*cos(pole->s) - a*pole->x*pole->y*sin(pole->s);
     693        A[0][1] = -a*pole->x*pole->y*cos(pole->s) + (1.0 - a*pole->y*pole->y)*sin(pole->s);
     694        A[0][2] = pole->x*cos(pole->s) + pole->y*sin(pole->s);
     695        A[1][0] = -(1.0 - a*pole->x*pole->x)*sin(pole->s) - a*pole->x*pole->y*cos(pole->s);
     696        A[1][1] = a*pole->x*pole->y*sin(pole->s) + (1.0 - a*pole->y*pole->y)*cos(pole->s);
     697        A[1][2] = -pole->x*sin(pole->s) + pole->y*cos(pole->s);
     698        A[2][0] = -pole->x;
     699        A[2][1] = -pole->y;
     700        A[2][2] = 1.0 - a*(pole->x*pole->x + pole->y*pole->y);
     701    */
    692702    A[0][0] = (1.0 - a*pole->x*pole->x)*cos(pole->s) - a*pole->x*pole->y*sin(pole->s);
    693     A[0][1] = -a*pole->x*pole->y*cos(pole->s) + (1.0 - a*pole->y*pole->y)*sin(pole->s);
    694     A[0][2] = pole->x*cos(pole->s) + pole->y*sin(pole->s);
    695     A[1][0] = -(1.0 - a*pole->x*pole->x)*sin(pole->s) - a*pole->x*pole->y*cos(pole->s);
     703    A[1][0] = -a*pole->x*pole->y*cos(pole->s) + (1.0 - a*pole->y*pole->y)*sin(pole->s);
     704    A[2][0] = pole->x*cos(pole->s) + pole->y*sin(pole->s);
     705    A[0][1] = -(1.0 - a*pole->x*pole->x)*sin(pole->s) - a*pole->x*pole->y*cos(pole->s);
    696706    A[1][1] = a*pole->x*pole->y*sin(pole->s) + (1.0 - a*pole->y*pole->y)*cos(pole->s);
    697     A[1][2] = -pole->x*sin(pole->s) + pole->y*cos(pole->s);
    698     A[2][0] = -pole->x;
    699     A[2][1] = -pole->y;
     707    A[2][1] = -pole->x*sin(pole->s) + pole->y*cos(pole->s);
     708    A[0][2] = -pole->x;
     709    A[1][2] = -pole->y;
    700710    A[2][2] = 1.0 - a*(pole->x*pole->x + pole->y*pole->y);
    701 
     711    double x, y, s;
     712    x = pole->x;
     713    y = pole->y;
     714    s = pole->s;
     715    /*    A[0][0] = (1.0 - a*x*x)*cos(s) + a*x*y*sin(s);
     716        A[0][1] = (1.0 - a*x*x)*sin(s) - a*x*y*cos(s);
     717        A[0][2] = x;
     718        A[1][0] = -a*x*y*cos(s) - (1.0 - a*y*y)*sin(s);
     719        A[1][1] = -a*x*y*sin(s) + (1.0 - a*y*y)*cos(s);
     720        A[1][2] = y;
     721        A[2][0] = -x*cos(s) + y*sin(s);
     722        A[2][1] = -x*sin(s) - y*cos(s);
     723        A[2][2] = 1.0 - a * (x*x + y*y);
     724    */
     725    /*    A[0][0] = (1.0 - a*x*x)*cos(s) + a*x*y*sin(s);
     726        A[1][0] = (1.0 - a*x*x)*sin(s) - a*x*y*cos(s);
     727        A[2][0] = x;
     728        A[0][1] = -a*x*y*cos(s) - (1.0 - a*y*y)*sin(s);
     729        A[1][1] = -a*x*y*sin(s) + (1.0 - a*y*y)*cos(s);
     730        A[2][1] = y;
     731        A[0][2] = -x*cos(s) + y*sin(s);
     732        A[1][2] = -x*sin(s) - y*cos(s);
     733        A[2][2] = 1.0 - a * (x*x + y*y);
     734    */
    702735    out = rotMatrix_To_Quat(A);
    703736
  • trunk/psLib/test/astro/tst_psEarthOrientation.c

    r5716 r5749  
    55*  @author d-Rob, MHPCC
    66*
    7 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
    8 *  @date $Date: 2005-12-07 02:13:40 $
     7*  @version $Revision: 1.20 $ $Name: not supported by cvs2svn $
     8*  @date $Date: 2005-12-08 02:49:04 $
    99*
    1010*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    6666{
    6767    if (obj == NULL) {
    68         obj = psSphereAlloc();
    69         obj->r = objR;
    70         obj->d = objD;
     68        //        obj = psSphereAlloc();
     69        //        obj->r = objR;
     70        //        obj->d = objD;
     71        psCube *tempCube = psCubeAlloc();
     72        tempCube->x = -0.3598480726985338;
     73        tempCube->y = 0.5555012823608123;
     74        tempCube->z = 0.7496183628158023;
     75        obj = psCubeToSphere(tempCube);
     76        psFree(tempCube);
    7177    }
    7278}
     
    544550        return 2;
    545551    }
    546     printf("\nOutput sphere rotation = %.13g, %.13g, %.13g, %.13g\n\n",
    547            teoceo->q0, teoceo->q1, teoceo->q2, teoceo->q3);
    548552
    549553    objSetup();
    550554    psSphereRot *earthRot = psSphereRotConjugate(NULL, teoceo);
    551555    psSphere *result = psSphereRotApply(NULL, earthRot, obj);
    552     //    psCube *cube = psSphereToCube(obj);
    553556    psCube *cube = psSphereToCube(result);
    554 
    555557
    556558    double x, y, z;
     
    558560    y = -0.6616523084626379;
    559561    z = 0.7496183628158023;
    560     if ( fabs(x-cube->x) > DBL_EPSILON  || fabs(y-cube->y) > DBL_EPSILON ||
    561             fabs(z-cube->z) > DBL_EPSILON) {
     562    if ( fabs(x-cube->x) > FLT_EPSILON  || fabs(y-cube->y) > FLT_EPSILON ||
     563            fabs(z-cube->z) > FLT_EPSILON) {
    562564        psError(PS_ERR_BAD_PARAMETER_VALUE, false,
    563565                "psSphereRot_TEOtoCEO returned incorrect values.\n");
     
    570572    }
    571573    //    psFree(now);
     574    psFree(rot);
     575    psFree(empty);
    572576    psFree(result);
    573577    psFree(obj);
     
    615619    }
    616620
     621    //    psCube *tempCube = psCubeAlloc();
     622    //    tempCube->x = -0.35963388069046304;
     623    //    tempCube->y = 0.5555192509816625;
     624    //    tempCube->z = 0.749078321908413;
     625    //    obj = psCubeToSphere(tempCube);
     626    //    psFree(tempCube);
     627    obj = psSphereAlloc();
     628    obj->r = objR;
     629    obj->d = objD;
     630    psSphereRot *precessionNutation = psSphereRotConjugate(NULL, rot);
     631    psSphere *result = psSphereRotApply(NULL, precessionNutation, obj);
     632    psCube *cube = psSphereToCube(result);
     633    double x, y, z;
     634    x = -0.3598480726985338;
     635    y = 0.5555012823608123;
     636    z = 0.7496183628158023;
     637    printf("\nOutput cube = x,y,z = %.13g, %.13g, %.13g\n", cube->x, cube->y, cube->z);
     638    printf("Expected cube = x,y,z = %.13g, %.13g, %.13g\n", x, y, z);
     639    printf("A difference of:   %.13g, %.13g, %.13g\n\n",
     640           (x-cube->x), (y-cube->y), (z-cube->z));
     641    psFree(obj);
     642
     643
    617644    if (fabs(rot->q0-q0) > DBL_EPSILON || fabs(rot->q1-q1) > DBL_EPSILON ||
    618645            fabs(rot->q2-q2) > DBL_EPSILON || fabs(rot->q3-q3) > DBL_EPSILON) {
     
    635662    printf("\n  Sphere -test- has values r,d = %.8g, %.8g \n", test->r, test->d);
    636663
     664    psFree(precessionNutation);
     665    psFree(result);
     666    psFree(cube);
     667
    637668    psFree(test);
    638669    psFree(rot);
Note: See TracChangeset for help on using the changeset viewer.