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

Last change on this file since 2723 was 2643, checked in by cmv, 21 years ago

update pour version 3.6.3 Xephem cmv 17/01/04

File size: 1.2 KB
Line 
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 */
11void
12satrings (
13double sb, double sl, double sr, /* Saturn hlat, hlong, sun dist */
14double el, double er, /* Earth hlong, sun dist */
15double JD, /* Julian date */
16double *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 */
45static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: rings.c,v $ $Date: 2005-01-17 10:13:07 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.