Bug #284 ยป pom.diff
games/pom/Makefile 5 Aug 2006 17:32:03 -0000 | ||
---|---|---|
MAN= pom.6
|
||
DPADD= ${LIBM}
|
||
LDADD= -lm
|
||
CFLAGS+=-Wall
|
||
.include <bsd.prog.mk>
|
games/pom/pom.c 5 Aug 2006 17:40:42 -0000 | ||
---|---|---|
#include <stdio.h>
|
||
#include <math.h>
|
||
#ifndef PI
|
||
#define PI 3.14159265358979323846
|
||
#endif
|
||
#define EPOCH 85
|
||
#define EPSILONg 279.611371 /* solar ecliptic long at EPOCH */
|
||
#define RHOg 282.680403 /* solar ecliptic long of perigee at EPOCH */
|
||
... | ... | |
static double potm (double);
|
||
int
|
||
main()
|
||
main(void)
|
||
{
|
||
time_t tt;
|
||
struct tm *GMT;
|
||
... | ... | |
* return phase of the moon
|
||
*/
|
||
static double
|
||
potm(days)
|
||
double days;
|
||
potm(double days)
|
||
{
|
||
double N, Msol, Ec, LambdaSol, l, Mm, Ev, Ac, A3, Mmprime;
|
||
double A4, lprime, V, ldprime, D, Nm;
|
||
... | ... | |
adj360(&N);
|
||
Msol = N + EPSILONg - RHOg; /* sec 42 #4 */
|
||
adj360(&Msol);
|
||
Ec = 360 / PI * ECCEN * sin(dtor(Msol)); /* sec 42 #5 */
|
||
Ec = 360 / M_PI * ECCEN * sin(dtor(Msol)); /* sec 42 #5 */
|
||
LambdaSol = N + Ec + EPSILONg; /* sec 42 #6 */
|
||
adj360(&LambdaSol);
|
||
l = 13.1763966 * days + lzero; /* sec 61 #4 */
|
||
... | ... | |
* convert degrees to radians
|
||
*/
|
||
static double
|
||
dtor(deg)
|
||
double deg;
|
||
dtor(double deg)
|
||
{
|
||
return(deg * PI / 180);
|
||
return(deg * M_PI / 180);
|
||
}
|
||
/*
|
||
... | ... | |
* adjust value so 0 <= deg <= 360
|
||
*/
|
||
static void
|
||
adj360(deg)
|
||
double *deg;
|
||
adj360(double *deg)
|
||
{
|
||
for (;;)
|
||
if (*deg < 0)
|