Changeset 5771 for trunk/psLib/src/astro/psEarthOrientation.c
- Timestamp:
- Dec 12, 2005, 3:31:54 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astro/psEarthOrientation.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astro/psEarthOrientation.c
r5749 r5771 8 8 * @author Robert Daniel DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.2 2$ $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 $ 12 12 * 13 13 * Copyright 2005 Maui High Performance Computing Center, University of Hawaii … … 432 432 double S = psPolynomial1DEval(sPoly,t); 433 433 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 434 439 // now calculate the non-poly portion from the tables 435 440 … … 448 453 double as = cols[1][lcv]; 449 454 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; 452 460 } 453 461 … … 465 473 double as = cols[1][lcv]; 466 474 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; 469 480 } 470 481 … … 482 493 double as = cols[1][lcv]; 483 494 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; 486 500 } 487 501 … … 700 714 A[2][2] = 1.0 - a*(pole->x*pole->x + pole->y*pole->y); 701 715 */ 716 702 717 A[0][0] = (1.0 - a*pole->x*pole->x)*cos(pole->s) - a*pole->x*pole->y*sin(pole->s); 703 718 A[1][0] = -a*pole->x*pole->y*cos(pole->s) + (1.0 - a*pole->y*pole->y)*sin(pole->s); … … 709 724 A[1][2] = -pole->y; 710 725 A[2][2] = 1.0 - a*(pole->x*pole->x + pole->y*pole->y); 726 711 727 double x, y, s; 712 728 x = pole->x; … … 1010 1026 psSphereRot *out = NULL; 1011 1027 1028 double x,y,s; 1029 x = motion->x; 1030 y = motion->y; 1031 s = motion->s; 1032 1033 1012 1034 //Setup Rotation Matrix for transformation (x,y,z rotation) 1013 1035 //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 1023 1150 1024 1151 //Convert rotation matrix to quaternions 1025 1152 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) ); 1026 1160 /* double diag_sum[3]; 1027 1161 int maxi;
Note:
See TracChangeset
for help on using the changeset viewer.
