| 1 | #include <stdio.h> | 
|---|
| 2 | #include <math.h> | 
|---|
| 3 | #include <stdlib.h> | 
|---|
| 4 |  | 
|---|
| 5 | #include "astro.h" | 
|---|
| 6 |  | 
|---|
| 7 | /*  RINGS OF SATURN by Olson, et al, BASIC Code from Sky & Telescope, May 1995. | 
|---|
| 8 | *  As converted from BASIC to C by pmartz@dsd.es.com (Paul Martz) | 
|---|
| 9 | *  Adapted to xephem by Elwood Charles Downey. | 
|---|
| 10 | */ | 
|---|
| 11 | void | 
|---|
| 12 | satrings ( | 
|---|
| 13 | double sb, double sl, double sr,        /* Saturn hlat, hlong, sun dist */ | 
|---|
| 14 | double el, double er,                   /* Earth hlong, sun dist */ | 
|---|
| 15 | double JD,                              /* Julian date */ | 
|---|
| 16 | double *etiltp, double *stiltp)         /* tilt from earth and sun, rads south*/ | 
|---|
| 17 | { | 
|---|
| 18 | double t, i, om; | 
|---|
| 19 | double x, y, z; | 
|---|
| 20 | double la, be; | 
|---|
| 21 | double s, b, sp, bp; | 
|---|
| 22 |  | 
|---|
| 23 | t = (JD-2451545.)/365250.; | 
|---|
| 24 | i = degrad(28.04922-.13*t+.0004*t*t); | 
|---|
| 25 | om = degrad(169.53+13.826*t+.04*t*t); | 
|---|
| 26 |  | 
|---|
| 27 | x = sr*cos(sb)*cos(sl)-er*cos(el); | 
|---|
| 28 | y = sr*cos(sb)*sin(sl)-er*sin(el); | 
|---|
| 29 | z = sr*sin(sb); | 
|---|
| 30 |  | 
|---|
| 31 | la = atan(y/x); | 
|---|
| 32 | if (x<0) la+=PI; | 
|---|
| 33 | be = atan(z/sqrt(x*x+y*y)); | 
|---|
| 34 |  | 
|---|
| 35 | s = sin(i)*cos(be)*sin(la-om)-cos(i)*sin(be); | 
|---|
| 36 | b = atan(s/sqrt(1.-s*s)); | 
|---|
| 37 | sp = sin(i)*cos(sb)*sin(sl-om)-cos(i)*sin(sb); | 
|---|
| 38 | bp = atan(sp/sqrt(1.-sp*sp)); | 
|---|
| 39 |  | 
|---|
| 40 | *etiltp = b; | 
|---|
| 41 | *stiltp = bp; | 
|---|
| 42 | } | 
|---|
| 43 |  | 
|---|
| 44 | /* For RCS Only -- Do Not Edit */ | 
|---|
| 45 | static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: rings.c,v $ $Date: 2009-07-16 10:34:39 $ $Revision: 1.7 $ $Name: not supported by cvs2svn $"}; | 
|---|