|
|
1.1 root 1: #include "sky.h"
2:
3: geo()
4: {
5:
6: /*
7: * uses alpha, delta, georad
8: */
9:
10: /*
11: * sets ra, decl, lha, decl2, az, el
12: */
13:
14: /*
15: * geo converts geocentric equatorial coordinates
16: * to topocentric equatorial and topocentric horizon
17: * coordinates.
18: * All are (usually) referred to the true equator.
19: */
20:
21: double sel, saz, caz;
22: double f;
23: double sa, ca, sd;
24:
25: /*
26: * convert to local hour angle and declination
27: */
28:
29: lha = gst - alpha - glong;
30: decl = delta;
31:
32: /*
33: * compute diurnal parallax (requires geocentric latitude)
34: */
35:
36: sa = cos(decl)*sin(lha);
37: ca = cos(decl)*cos(lha) - erad*cos(glat)*sin(hp);
38: sd = sin(decl) - erad*sin(glat)*sin(hp);
39:
40: lha = atan2(sa, ca);
41: decl2 = atan2(sd, sqrt(sa*sa+ca*ca));
42: f = sqrt(sa*sa+ca*ca+sd*sd);
43: semi2 = semi/f;
44: ra = gst - lha - glong;
45: while(ra > pi)
46: ra -= 2*pi;
47: while(ra < -pi)
48: ra += 2*pi;
49:
50: /*
51: * convert to horizon coordinates
52: */
53:
54: sel = sin(nlat)*sin(decl2) + cos(nlat)*cos(decl2)*cos(lha);
55: el = atan2(sel, sqrt(1.-sel*sel));
56: saz = sin(lha)*cos(decl2);
57: caz = cos(nlat)*sin(decl2) - sin(nlat)*cos(decl2)*cos(lha);
58: az = pi + atan2(saz, -caz);
59:
60: az /= radian;
61: el /= radian;
62:
63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.