Changeset 2197 for trunk/psLib/src/astronomy/psCoord.c
- Timestamp:
- Oct 26, 2004, 11:25:59 AM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/src/astronomy/psCoord.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/astronomy/psCoord.c
r2104 r2197 10 10 * @author George Gusciora, MHPCC 11 11 * 12 * @version $Revision: 1.2 5$ $Name: not supported by cvs2svn $13 * @date $Date: 2004-10- 14 01:17:50$12 * @version $Revision: 1.26 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-10-26 21:24:42 $ 14 14 * 15 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 58 58 /*****************************************************************************/ 59 59 60 static float p_psArg(float x, float y);61 62 /******************************************************************************63 XXX: Verify this arc tan function.64 XXX: macro65 XXX: I don't think this arg() is correct.66 *****************************************************************************/67 68 float p_psArg(float x,69 float y)70 {71 if (y!= 0.0) {72 return(atan(y/x));73 } else {74 return(0.5 * M_PI);75 }76 return (0.0);77 /*78 if (x > 0) {79 return (atan(y / x));80 } else if ((x == 0) && (y == 0)) {81 return (0.5 * M_PI);82 } else if ((x == 0) && (y == 0)) {83 return (-0.5 * M_PI);84 } else if ((x == 0) && (y == 0)) {85 return (M_PI + atan(y / x));86 } else if ((x == 0) && (y == 0)) {87 return (-M_PI + atan(y / x));88 }89 psAbort(__func__, "Unacceptable range for (p_psArg(%f, %f).\n", x, y);90 */91 }92 93 60 /*****************************************************************************/ 94 61 /* FUNCTION IMPLEMENTATION - PUBLIC */ … … 292 259 if (projection->type == PS_PROJ_TAN) { 293 260 R = sqrt((coord->x * coord->x) + (coord->y * coord->y)); 294 tmp->d = p_psArg(-coord->y, coord->x);261 tmp->d = atan2(-coord->y, coord->x); 295 262 tmp->r = atan(180.0 / (R * M_PI)); 296 263 297 264 } else if (projection->type == PS_PROJ_SIN) { 298 265 R = sqrt((coord->x * coord->x) + (coord->y * coord->y)); 299 tmp->d = p_psArg(-coord->y, coord->x);266 tmp->d = atan2(-coord->y, coord->x); 300 267 tmp->r = acos((R * M_PI) / 180.0); 301 268 … … 314 281 chu2 *= chu2; 315 282 chu = sqrt(1.0 - chu1 - chu2); 316 tmp->d = 2.0 * p_psArg((2.0 * chu * chu) - 1.0, (coord->x * chu * M_PI) / 360.0);283 tmp->d = 2.0 * atan2((2.0 * chu * chu) - 1.0, (coord->x * chu * M_PI) / 360.0); 317 284 tmp->r = asin((coord->y * chu * M_PI) / 180.0); 318 285
Note:
See TracChangeset
for help on using the changeset viewer.
