1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
/*
* Sun clock. X11 version by John Mackin.
*
* This program was derived from, and is still in part identical with, the
* Suntools Sun clock program whose author's comment appears immediately
* below. Please preserve both notices.
*
* The X11R3/4 version of this program was written by John Mackin, at the
* Basser Department of Computer Science, University of Sydney, Sydney,
* New South Wales, Australia; <john@cs.su.oz.AU>. This program, like
* the one it was derived from, is in the public domain: `Love is the
* law, love under will.'
*/
/*
Sun clock
Designed and implemented by John Walker in November of 1988.
Version for the Sun Workstation.
The algorithm used to calculate the position of the Sun is given in
Chapter 18 of:
"Astronomical Formulae for Calculators" by Jean Meeus, Third Edition,
Richmond: Willmann-Bell, 1985. This book can be obtained from:
Willmann-Bell
P.O. Box 35025
Richmond, VA 23235
USA
Phone: (804) 320-7016
This program was written by:
John Walker
Autodesk, Inc.
2320 Marinship Way
Sausalito, CA 94965
USA
Fax: (415) 389-9418
Voice: (415) 332-2344 Ext. 2829
Usenet: {sun,well,uunet}!acad!kelvin
or: kelvin@acad.uu.net
modified for interactive maps by
Stephen Martin
Fujitsu Systems Business of Canada
smartin@fujitsu.ca
This program is in the public domain: "Do what thou wilt shall be the
whole of the law". I'd appreciate receiving any bug fixes and/or
enhancements, which I'll incorporate in future versions of the
program. Please leave the original attribution information intact so
that credit and blame may be properly apportioned.
Revision history:
1.0 12/21/89 Initial version.
8/24/89 Finally got around to submitting.
1.1 8/31/94 Version with interactive map.
1.2 10/12/94 Fixes for HP and Solaris, new icon bitmap
1.3 11/01/94 Timezone now shown in icon
1.4 03/29/98 Fixed city drawing, added icon animation
*/
#ifndef SUNCLOCK_H
#define SUNCLOCK_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#ifndef PI
#define PI 3.14159265358979323846
#endif
#ifndef E
#define E 2.7182818284590452354
#endif
#define abs(x) ((x) < 0 ? (-(x)) : x) /* Absolute value */
#define sgn(x) (((x) < 0) ? -1 : ((x) > 0 ? 1 : 0)) /* Extract sign */
#define dtr(x) ((x) * (PI / 180.0)) /* Degree->Radian */
#define rtd(x) ((x) / (PI / 180.0)) /* Radian->Degree */
#define fixangle(a) ((a) - 360.0 * (floor((a) / 360.0))) /* Fix angle */
#define TERMINC 100 /* Circle segments for terminator */
#define PROJINT (60 * 10) /* Frequency of seasonal recalculation */
#endif
|