pom.diff
games/pom/Makefile 5 Aug 2006 17:32:03 0000  

7  7 
MAN= pom.6 
8  8 
DPADD= ${LIBM} 
9  9 
LDADD= lm 
10 
CFLAGS+=Wall 

11  10  
12  11 
.include <bsd.prog.mk> 
games/pom/pom.c 5 Aug 2006 17:40:42 0000  

52  52 
#include <stdio.h> 
53  53 
#include <math.h> 
54  54  
55 
#ifndef PI 

56 
#define PI 3.14159265358979323846 

57 
#endif 

58  55 
#define EPOCH 85 
59  56 
#define EPSILONg 279.611371 /* solar ecliptic long at EPOCH */ 
60  57 
#define RHOg 282.680403 /* solar ecliptic long of perigee at EPOCH */ 
...  ...  
69  66 
static double potm (double); 
70  67  
71  68 
int 
72 
main() 

69 
main(void)


73  70 
{ 
74  71 
time_t tt; 
75  72 
struct tm *GMT; 
...  ...  
113  110 
* return phase of the moon 
114  111 
*/ 
115  112 
static double 
116 
potm(days) 

117 
double days; 

113 
potm(double days) 

118  114 
{ 
119  115 
double N, Msol, Ec, LambdaSol, l, Mm, Ev, Ac, A3, Mmprime; 
120  116 
double A4, lprime, V, ldprime, D, Nm; 
...  ...  
123  119 
adj360(&N); 
124  120 
Msol = N + EPSILONg  RHOg; /* sec 42 #4 */ 
125  121 
adj360(&Msol); 
126 
Ec = 360 / PI * ECCEN * sin(dtor(Msol)); /* sec 42 #5 */ 

122 
Ec = 360 / M_PI * ECCEN * sin(dtor(Msol)); /* sec 42 #5 */


127  123 
LambdaSol = N + Ec + EPSILONg; /* sec 42 #6 */ 
128  124 
adj360(&LambdaSol); 
129  125 
l = 13.1763966 * days + lzero; /* sec 61 #4 */ 
...  ...  
150  146 
* convert degrees to radians 
151  147 
*/ 
152  148 
static double 
153 
dtor(deg) 

154 
double deg; 

149 
dtor(double deg) 

155  150 
{ 
156 
return(deg * PI / 180); 

151 
return(deg * M_PI / 180);


157  152 
} 
158  153  
159  154 
/* 
...  ...  
161  156 
* adjust value so 0 <= deg <= 360 
162  157 
*/ 
163  158 
static void 
164 
adj360(deg) 

165 
double *deg; 

159 
adj360(double *deg) 

166  160 
{ 
167  161 
for (;;) 
168  162 
if (*deg < 0) 