source: Sophya/trunk/SophyaExt/XephemAstroLib/thetag.c

Last change on this file was 4017, checked in by cmv, 14 years ago

fichiers de Xephem 3.7.5 update, cmv 21/09/2011

File size: 1.8 KB
Line 
1#include <math.h>
2
3#include "deepconst.h"
4
5/* @(#) $Id: thetag.c,v 1.9 2011-09-21 16:17:51 cmv Exp $ */
6
7
8/*
9 * FUNCTION THETAG(EP)
10 * COMMON /E1/XMO,XNODEO,OMEGAO,EO,XINCL,XNO,XNDT2O,XNDD6O,BSTAR,
11 * 1 X,Y,Z,XDOT,YDOT,ZDOT,EPOCH,DS50
12 * DOUBLE PRECISION EPOCH,D,THETA,TWOPI,YR,TEMP,EP,DS50
13 * TWOPI=6.28318530717959D0
14 * YR=(EP+2.D-7)*1.D-3
15 * JY=YR
16 * YR=JY
17 * D=EP-YR*1.D3
18 * IF(JY.LT.10) JY=JY+80
19 * N=(JY-69)/4
20 * IF(JY.LT.70) N=(JY-72)/4
21 * DS50=7305.D0 + 365.D0*(JY-70) +N + D
22 * THETA=1.72944494D0 + 6.3003880987D0*DS50
23 * TEMP=THETA/TWOPI
24 * I=TEMP
25 * TEMP=I
26 * THETAG=THETA-TEMP*TWOPI
27 * IF(THETAG.LT.0.D0) THETAG=THETAG+TWOPI
28 * RETURN
29 * END
30 */
31
32/* FUNCTION THETAG(EP) */
33double
34thetag(double EP, double *DS50)
35{
36 int JY, N, I;
37 double YR, D, THETA, TEMP, THETAG;
38
39 YR = (EP + 2.0E-7) * 1.0E-3;
40
41 JY = (int) YR;
42
43 YR = JY;
44
45 D = EP - YR * 1.0E3;
46
47 if(JY < 10)
48 JY += 80;
49
50 N = (JY - 69) / 4;
51
52 if(JY < 70)
53 N = (JY - 72) / 4;
54
55/* printf("N = %d\n", N); */
56
57 *DS50 = 7305.0 + 365.0 * (JY-70) + N + D;
58
59/* printf("DS50 = %f\n", *DS50); */
60
61 THETA = 1.72944494 + 6.3003880987 * *DS50;
62
63/* printf("THETA = %f\n", THETA); */
64
65 TEMP = THETA / TWOPI;
66
67 I = (int)TEMP;
68 TEMP = I;
69
70 THETAG = THETA - TEMP * TWOPI;
71
72 if(THETAG < 0.0)
73 THETAG += TWOPI;
74
75 return THETAG;
76}
77
78#if 0
79void main(int argc, char **argv) {
80 double ds50, gwa;
81
82 if(argc >= 2) {
83 gwa = thetag(atof(argv[1]), &ds50);
84 printf("%f, %f\n", gwa, ds50);
85 }
86}
87#endif
88
89/* For RCS Only -- Do Not Edit */
90static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: thetag.c,v $ $Date: 2011-09-21 16:17:51 $ $Revision: 1.9 $ $Name: not supported by cvs2svn $"};
Note: See TracBrowser for help on using the repository browser.