Changeset 19823 for trunk/Ohana/src/libohana
- Timestamp:
- Oct 2, 2008, 8:08:31 AM (18 years ago)
- Location:
- trunk/Ohana/src/libohana
- Files:
-
- 2 edited
-
include/ohana.h (modified) (1 diff)
-
src/time.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/libohana/include/ohana.h
r16121 r19823 203 203 double ohana_lst PROTO((double jd, double longitude)); 204 204 int ohana_str_to_radec PROTO((double *ra, double *dec, char *str1, char *str2)); 205 double ohana_normalize_angle PROTO((double angle)); 205 206 206 207 int hstgsc_hms_to_deg PROTO((double *h0, double *h1, double *d0, double *d1, char *string)); -
trunk/Ohana/src/libohana/src/time.c
r14590 r19823 434 434 return (sid_g); 435 435 } 436 437 double ohana_normalize_angle (double angle) { 438 439 double result; 440 441 // take an input angle and force the domain to be 0.0 - 360.0 442 // there are a few ways to do this: 443 444 // option 1: This is a potentially very slow method, also subject to round off errors 445 # if (0) 446 while (angle > 360.0) angle -= 360.0; 447 while (angle < 0.0) angle += 360.0; 448 # endif 449 450 // option 2: take sin & cos, apply atan2 (y, x) 451 # if (1) 452 double x, y; 453 454 x = cos(angle*RAD_DEG); 455 y = sin(angle*RAD_DEG); 456 457 result = atan2 (y, x); 458 if (result < 0.0) result += 360.0; 459 # endif 460 461 # if (0) 462 // option 3: 463 int nCircle = angle / 360.0; 464 result -= 360.0*nCircle; 465 if (result < 0.0) result += 360.0; 466 # endif 467 468 return (result); 469 }
Note:
See TracChangeset
for help on using the changeset viewer.
