IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 12, 2005, 3:31:54 PM (21 years ago)
Author:
drobbin
Message:

Updated tests and debugged code. PrecessionModel now working.

File:
1 edited

Legend:

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

    r5749 r5771  
    88 *  @author Robert Daniel DeSonia, MHPCC
    99 *
    10  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    11  *  @date $Date: 2005-12-08 02:49:04 $
     10 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     11 *  @date $Date: 2005-12-13 01:31:54 $
    1212 *
    1313 *  Copyright 2005 Maui High Performance Computing Center, University of Hawaii
     
    432432    double S = psPolynomial1DEval(sPoly,t);
    433433
     434    X = SEC_TO_RAD(X * 1e-6);
     435    Y = SEC_TO_RAD(Y * 1e-6);
     436    S = SEC_TO_RAD(S * 1e-6);
     437
     438
    434439    // now calculate the non-poly portion from the tables
    435440
     
    448453        double as = cols[1][lcv];
    449454        double ac = cols[2][lcv];
    450 
    451         X += as*tj*sin(arg) + ac*tj*cos(arg);
     455        //        printf("as-x, ac-x, = %.13g, %.13g\n", as, ac);
     456        as = SEC_TO_RAD(as) * 1e-6;
     457        ac = SEC_TO_RAD(ac) * 1e-6;
     458        //        X += as*tj*sin(arg) + ac*tj*cos(arg);
     459        X += (as*tj*sin(arg) + ac*cos(arg)) * tj;
    452460    }
    453461
     
    465473        double as = cols[1][lcv];
    466474        double ac = cols[2][lcv];
    467 
    468         Y += as*tj*sin(arg) + ac*tj*cos(arg);
     475        as = SEC_TO_RAD(as) * 1e-6;
     476        ac = SEC_TO_RAD(ac) * 1e-6;
     477
     478        //        Y += as*tj*sin(arg) + ac*tj*cos(arg);
     479        Y += (as*tj*sin(arg) + ac*cos(arg)) * tj;
    469480    }
    470481
     
    482493        double as = cols[1][lcv];
    483494        double ac = cols[2][lcv];
    484 
    485         S += as*tj*sin(arg) + ac*tj*cos(arg);
     495        as = SEC_TO_RAD(as) * 1e-6;
     496        ac = SEC_TO_RAD(ac) * 1e-6;
     497
     498        //        S += as*tj*sin(arg) + ac*tj*cos(arg);
     499        S += (as*tj*sin(arg) + ac*cos(arg)) * tj;
    486500    }
    487501
     
    700714        A[2][2] = 1.0 - a*(pole->x*pole->x + pole->y*pole->y);
    701715    */
     716
    702717    A[0][0] = (1.0 - a*pole->x*pole->x)*cos(pole->s) - a*pole->x*pole->y*sin(pole->s);
    703718    A[1][0] = -a*pole->x*pole->y*cos(pole->s) + (1.0 - a*pole->y*pole->y)*sin(pole->s);
     
    709724    A[1][2] = -pole->y;
    710725    A[2][2] = 1.0 - a*(pole->x*pole->x + pole->y*pole->y);
     726
    711727    double x, y, s;
    712728    x = pole->x;
     
    10101026    psSphereRot *out = NULL;
    10111027
     1028    double x,y,s;
     1029    x = motion->x;
     1030    y = motion->y;
     1031    s = motion->s;
     1032
     1033
    10121034    //Setup Rotation Matrix for transformation (x,y,z rotation)
    10131035    //XXX: May need to be (z,y,x as in Mathworld?)
    1014     A[0][0] = cos(motion->x)*cos(-motion->s);
    1015     A[0][1] = sin(motion->y)*sin(motion->x)*cos(-motion->s) + cos(motion->y)*sin(-motion->s);
    1016     A[0][2] = -cos(motion->y)*sin(motion->x)*cos(-motion->s) + sin(motion->y)*sin(-motion->s);
    1017     A[1][0] = -cos(motion->x)*sin(-motion->s);
    1018     A[1][1] = -sin(motion->y)*sin(motion->x)*sin(-motion->s) + cos(motion->y)*cos(-motion->s);
    1019     A[1][2] = cos(motion->y)*sin(motion->x)*sin(-motion->s) + sin(motion->y)*cos(-motion->s);
    1020     A[2][0] = sin(motion->x);
    1021     A[2][1] = -sin(motion->y)*cos(motion->x);
    1022     A[2][2] = cos(motion->y)*cos(motion->x);
     1036    /*   A[0][0] = cos(motion->x)*cos(-motion->s);
     1037        A[0][1] = sin(motion->y)*sin(motion->x)*cos(-motion->s) + cos(motion->y)*sin(-motion->s);
     1038        A[0][2] = -cos(motion->y)*sin(motion->x)*cos(-motion->s) + sin(motion->y)*sin(-motion->s);
     1039        A[1][0] = -cos(motion->x)*sin(-motion->s);
     1040        A[1][1] = -sin(motion->y)*sin(motion->x)*sin(-motion->s) + cos(motion->y)*cos(-motion->s);
     1041        A[1][2] = cos(motion->y)*sin(motion->x)*sin(-motion->s) + sin(motion->y)*cos(-motion->s);
     1042        A[2][0] = sin(motion->x);
     1043        A[2][1] = -sin(motion->y)*cos(motion->x);
     1044        A[2][2] = cos(motion->y)*cos(motion->x);
     1045    */
     1046    /*
     1047        A[0][0] = cos(motion->x)*cos(-motion->s);
     1048        A[1][0] = sin(motion->y)*sin(motion->x)*cos(-motion->s) + cos(motion->y)*sin(-motion->s);
     1049        A[2][0] = -cos(motion->y)*sin(motion->x)*cos(-motion->s) + sin(motion->y)*sin(-motion->s);
     1050        A[0][1] = -cos(motion->x)*sin(-motion->s);
     1051        A[1][1] = -sin(motion->y)*sin(motion->x)*sin(-motion->s) + cos(motion->y)*cos(-motion->s);
     1052        A[2][1] = cos(motion->y)*sin(motion->x)*sin(-motion->s) + sin(motion->y)*cos(-motion->s);
     1053        A[0][2] = sin(motion->x);
     1054        A[1][2] = -sin(motion->y)*cos(motion->x);
     1055        A[2][2] = cos(motion->y)*cos(motion->x);
     1056    */
     1057    /*
     1058        A[0][0] = cos(s)*cos(x);
     1059        A[0][1] = sin(s)*sin(y) + cos(s)*sin(x)*sin(y);
     1060        A[0][2] = sin(s)*sin(y) - cos(s)*sin(x)*cos(y);
     1061        A[1][0] = -sin(s)*cos(x);
     1062        A[1][1] = cos(s)*cos(y) - sin(s)*sin(x)*sin(y);
     1063        A[1][2] = cos(s)*sin(y) + sin(s)*sin(x)*cos(y);
     1064        A[2][0] = sin(x);
     1065        A[2][1] = -cos(x)*sin(y);
     1066        A[2][2] = cos(x)*cos(y);
     1067    */
     1068    /*
     1069        A[0][0] = cos(s)*cos(x);
     1070        A[1][0] = sin(s)*sin(y) + cos(s)*sin(x)*sin(y);
     1071        A[2][0] = sin(s)*sin(y) - cos(s)*sin(x)*cos(y);
     1072        A[0][1] = -sin(s)*cos(x);
     1073        A[1][1] = cos(s)*cos(y) - sin(s)*sin(x)*sin(y);
     1074        A[2][1] = cos(s)*sin(y) + sin(s)*sin(x)*cos(y);
     1075        A[0][2] = sin(x);
     1076        A[1][2] = -cos(x)*sin(y);
     1077        A[2][2] = cos(x)*cos(y);
     1078    */
     1079
     1080    /*
     1081        psSphereRot r,s,t;
     1082     
     1083        // directly from ADD -- there must be a better way?!
     1084        r.q0=sin(motion->y/2.0);
     1085        r.q1=0;
     1086        r.q2=0;
     1087        r.q3=cos(motion->y/2.0);
     1088     
     1089        s.q0=0;
     1090        s.q1=sin(motion->x/2.0);
     1091        s.q2=0;
     1092        s.q3=cos(motion->x/2.0);
     1093     
     1094        t.q0=0;
     1095        t.q1=0;
     1096        t.q2=sin(-motion->s/2.0);
     1097        t.q3=cos(-motion->s/2.0);
     1098     
     1099        // calculate t*s*r.
     1100        psSphereRot* temp = psSphereRotCombine(NULL,&t,&s);
     1101        out = psSphereRotCombine(NULL, temp, &r);
     1102        psFree(temp);
     1103     
     1104        return out;
     1105    */
     1106
     1107    s = -s;
     1108    //Newest trial - mult. y matrix * x * z
     1109    /*    A[0][0] = cos(x)*cos(s);
     1110        A[1][0] = cos(x)*sin(s);
     1111        A[2][0] = -sin(x);
     1112        A[0][1] = sin(x)*sin(y)*cos(s) - cos(y)*sin(s);
     1113        A[1][1] = sin(x)*sin(y)*sin(s) + cos(y)*cos(s);
     1114        A[2][1] = cos(x)*sin(y);
     1115        A[0][2] = sin(x)*cos(y)*cos(s) + sin(y)*sin(s);
     1116        A[1][2] = sin(x)*cos(y)*sin(s) - sin(y)*cos(s);
     1117        A[2][2] = cos(x)*cos(y);
     1118    */
     1119    /*    A[0][0] = cos(x)*cos(s);
     1120        A[0][1] = cos(x)*sin(s);
     1121        A[0][2] = -sin(x);
     1122        A[1][0] = sin(x)*sin(y)*cos(s) - cos(y)*sin(s);
     1123        A[1][1] = sin(x)*sin(y)*sin(s) + cos(y)*cos(s);
     1124        A[1][2] = cos(x)*sin(y);
     1125        A[2][0] = sin(x)*cos(y)*cos(s) + sin(y)*sin(s);
     1126        A[2][1] = sin(x)*cos(y)*sin(s) - sin(y)*cos(s);
     1127        A[2][2] = cos(x)*cos(y);
     1128    */
     1129    //New trial - mult z * y * x
     1130    /*    A[0][0] = cos(s)*cos(x);
     1131        A[1][0] = sin(s)*cos(y) + cos(s)*sin(x)*sin(y);
     1132        A[2][0] = sin(s)*sin(y) - cos(s)*sin(x)*cos(y);
     1133        A[0][1] = -sin(s)*cos(x);
     1134        A[1][1] = cos(s)*cos(y) - sin(s)*sin(x)*sin(y);
     1135        A[2][1] = cos(s)*sin(y) + sin(s)*sin(x)*cos(y);
     1136        A[0][2] = sin(x);
     1137        A[1][2] = -cos(x)*sin(y);
     1138        A[2][2] = cos(x)*cos(y);
     1139    */
     1140    A[0][0] = cos(s)*cos(x);
     1141    A[0][1] = sin(s)*cos(y) + cos(s)*sin(x)*sin(y);
     1142    A[0][2] = sin(s)*sin(y) - cos(s)*sin(x)*cos(y);
     1143    A[1][0] = -sin(s)*cos(x);
     1144    A[1][1] = cos(s)*cos(y) - sin(s)*sin(x)*sin(y);
     1145    A[1][2] = cos(s)*sin(y) + sin(s)*sin(x)*cos(y);
     1146    A[2][0] = sin(x);
     1147    A[2][1] = -cos(x)*sin(y);
     1148    A[2][2] = cos(x)*cos(y);
     1149
    10231150
    10241151    //Convert rotation matrix to quaternions
    10251152    out = rotMatrix_To_Quat(A);
     1153
     1154    //    out = psSphereRotAlloc(motion->y, motion->x, motion->s);
     1155
     1156    //    out->q0 = SEC_TO_RAD(out->q0);
     1157    //    out->q1 = SEC_TO_RAD(out->q1);
     1158    //    out->q2 = SEC_TO_RAD(out->q2) + (out->q0+out->q1/2.0);
     1159    //    out->q3 = sqrt(1.0 - (out->q0*out->q0 + out->q1*out->q1 + out->q2*out->q2) );
    10261160    /*    double diag_sum[3];
    10271161        int maxi;
Note: See TracChangeset for help on using the changeset viewer.