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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
use angle;
use coords;
use planet;
#[inline]
pub fn eq_hz_parallax(dist_to_earth: f64) -> f64 {
(angle::deg_frm_dms(0, 0, 8.794).to_radians().sin() / dist_to_earth).asin()
}
pub fn topocent_eq_coords (
eq_point : &coords::EqPoint,
eq_hz_parllx : f64,
geograph_point : &coords::GeographPoint,
observer_ht : f64,
greenw_sidr : f64
) -> coords::EqPoint {
let (rho_sin, rho_cos) = planet::earth::rho_sin_cos_phi (
geograph_point.lat, observer_ht
);
let geocent_hr_angl = coords::hr_angl_frm_observer_long (
greenw_sidr, geograph_point.long, eq_point.asc
);
let eq_hz_parllx_sin = eq_hz_parllx.sin();
let del_asc = (-rho_cos * eq_hz_parllx_sin * geocent_hr_angl.sin()).atan2(
eq_point.dec.cos()
- rho_cos * eq_hz_parllx_sin * geocent_hr_angl.cos()
);
let dec_1 = (
(eq_point.dec.sin() - rho_sin * eq_hz_parllx_sin) * del_asc.cos()
).atan2(
eq_point.dec.cos()
- rho_cos * eq_hz_parllx_sin * geocent_hr_angl.cos()
);
coords::EqPoint {
asc: eq_point.asc + del_asc,
dec: dec_1
}
}
pub fn topopcent_ecl_coords (
ecl_point : &coords::EclPoint,
eq_hz_parllx : f64,
geograph_point : &coords::GeographPoint,
observer_ht : f64,
loc_sidr : f64,
eclip_oblq : f64,
geocent_semdia : f64
) -> (coords::EclPoint, f64) {
let (rho_sin, rho_cos) = planet::earth::rho_sin_cos_phi (
geograph_point.lat, observer_ht
);
let eq_hz_parllx_sin = eq_hz_parllx.sin();
let loc_sidr_sin = loc_sidr.sin();
let eclip_oblq_sin = eclip_oblq.sin();
let eclip_oblq_cos = eclip_oblq.cos();
let ecl_point_lat_cos = ecl_point.lat.cos();
let N =
ecl_point.long.cos() * ecl_point_lat_cos
- rho_cos * eq_hz_parllx_sin * loc_sidr.cos();
let ecl_long_1 = (
ecl_point.long.sin() * ecl_point_lat_cos
- eq_hz_parllx_sin * (
rho_sin * eclip_oblq_sin +
rho_cos * eclip_oblq_cos * loc_sidr_sin
)
).atan2(N);
let ecl_lat_1 = (
ecl_long_1.cos() * (
ecl_point.lat.sin()
- eq_hz_parllx_sin * (
rho_sin * eclip_oblq_cos -
rho_cos * eclip_oblq_sin * loc_sidr_sin
)
)
).atan2(N);
let geocent_semdia_1 = (
ecl_long_1.cos() * ecl_lat_1.cos() * geocent_semdia.sin() / N
).asin();
(
coords::EclPoint {
long: angle::limit_to_two_PI(ecl_long_1),
lat: ecl_lat_1
},
geocent_semdia_1
)
}