Changeset 14288
- Timestamp:
- Jul 18, 2007, 8:47:53 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/libdvo/src/coordops.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libdvo/src/coordops.c
r12752 r14288 72 72 case PROJ_TAN: 73 73 case PROJ_DIS: 74 // R = cot (theta) = cos(theta) / sin(theta) 74 75 if (R == 0) { 75 76 stht = 1.0; … … 82 83 break; 83 84 case PROJ_STG: 85 // R = (180/pi) [2 cos (theta) / 1 + sin (theta)] 84 86 stht = (4 - RAD_DEG*R) / (4 + RAD_DEG*R); 85 87 ctht = sqrt (1 - stht*stht); 86 88 break; 87 89 case PROJ_SIN: 90 // R = (180/pi) cos (theta) 88 91 ctht = RAD_DEG * R; 89 92 stht = sqrt (1 - ctht*ctht); 93 break; 94 case PROJ_ARC: 95 // R = 90 - theta (degrees) 96 ctht = sin (RAD_DEG * R); 97 stht = cos (RAD_DEG * R); 90 98 break; 91 99 case PROJ_ZEA: … … 161 169 double phi, theta; 162 170 double Lo, Mo; 163 double sphi, cphi, stht ;171 double sphi, cphi, stht, ctht; 164 172 double salp, calp, sdel, cdel, sdp, cdp; 165 173 double P, A, Rc; … … 201 209 cphi = cdel*sdp*calp - sdel*cdp; /* = cos(theta)*cos(phi) */ 202 210 211 // L = +R sin(phi) 212 // M = -R cos(phi) 213 203 214 switch (proj) { 204 215 case PROJ_TAN: 205 216 case PROJ_DIS: 217 // R = cot (theta) = cos(theta) / sin(theta) 206 218 Rc = hypot(sphi, cphi); 207 219 *L = (stht == 0) ? 180.0 * sphi / Rc : +DEG_RAD * sphi / stht; 208 220 *M = (stht == 0) ? 180.0 * cphi / Rc : -DEG_RAD * cphi / stht; 209 221 return (stht > 0); 222 case PROJ_STG: 223 // R = 2 cos(theta) / [1 + sin(theta)] 224 Rc = DEG_RAD * 2 / (1 + stht); 225 *L = +Rc * sphi; 226 *M = -Rc * cphi; 227 return (stht > 0); 210 228 case PROJ_SIN: 229 // R = cos(theta) 211 230 *L = +DEG_RAD * sphi; 212 231 *M = -DEG_RAD * cphi; 213 232 return (stht > 0); 233 case PROJ_ARC: 234 // R = 90 - theta 235 ctht = hypot(sphi, cphi); 236 theta = atan2 (stht, ctht); 237 Rc = 90 - DEG_RAD * theta; 238 *L = (ctht == 0.0) ? 0.0 : +Rc * sphi / ctht ; 239 *M = (ctht == 0.0) ? 0.0 : -Rc * cphi / ctht ; 240 return (TRUE); 214 241 case PROJ_ZEA: 215 242 case PROJ_ZPL: 243 // R = 90 - theta 216 244 Rc = DEG_RAD * M_SQRT2 / sqrt (1 + stht); 217 245 *L = Rc * sphi;
Note:
See TracChangeset
for help on using the changeset viewer.
