source: Sophya/trunk/SophyaExt/XephemAstroLib/rings.c@ 1719

Last change on this file since 1719 was 1719, checked in by cmv, 24 years ago

Adapted to version 3.5 xephem cmv 22/10/2001

File size: 1.1 KB
RevLine 
[1719]1#include <stdio.h>
2#include <math.h>
3#if defined(__STDC__)
4#include <stdlib.h>
5#endif
6
7#include "P_.h"
8#include "astro.h"
9#include "circum.h"
10
11/* RINGS OF SATURN by Olson, et al, BASIC Code from Sky & Telescope, May 1995.
12 * As converted from BASIC to C by pmartz@dsd.es.com (Paul Martz)
13 * Adapted to xephem by Elwood Charles Downey.
14 */
15void
16satrings (sb, sl, sr, el, er, JD, etiltp, stiltp)
17double sb, sl, sr; /* Saturn hlat, hlong, sun dist */
18double el, er; /* Earth hlong, sun dist */
19double JD; /* Julian date */
20double *etiltp, *stiltp; /* tilt from earth and sun, rads southward */
21{
22 double t, i, om;
23 double x, y, z;
24 double la, be;
25 double s, b, sp, bp;
26
27 t = (JD-2451545.)/365250.;
28 i = degrad(28.04922-.13*t+.0004*t*t);
29 om = degrad(169.53+13.826*t+.04*t*t);
30
31 x = sr*cos(sb)*cos(sl)-er*cos(el);
32 y = sr*cos(sb)*sin(sl)-er*sin(el);
33 z = sr*sin(sb);
34
35 la = atan(y/x);
36 if (x<0) la+=PI;
37 be = atan(z/sqrt(x*x+y*y));
38
39 s = sin(i)*cos(be)*sin(la-om)-cos(i)*sin(be);
40 b = atan(s/sqrt(1.-s*s));
41 sp = sin(i)*cos(sb)*sin(sl-om)-cos(i)*sin(sb);
42 bp = atan(sp/sqrt(1.-sp*sp));
43
44 *etiltp = b;
45 *stiltp = bp;
46}
Note: See TracBrowser for help on using the repository browser.