practical_astronomy_rust/
cometdata.rs1pub struct CometInfoElliptical {
11 pub name: String,
12 pub epoch: f64,
13 pub peri: f64,
14 pub node: f64,
15 pub period: f64,
16 pub axis: f64,
17 pub ecc: f64,
18 pub incl: f64,
19}
20
21pub struct CometInfoParabolic {
30 pub name: String,
31 pub epoch_peri_day: f64,
32 pub epoch_peri_month: u32,
33 pub epoch_peri_year: u32,
34 pub arg_peri: f64,
35 pub node: f64,
36 pub peri_dist: f64,
37 pub incl: f64,
38}
39
40pub fn get_comet_info_elliptical_vector(comet_name: String) -> (CometInfoElliptical, String) {
46 let mut comet_elliptical_vector: Vec<CometInfoElliptical> = Vec::new();
47
48 comet_elliptical_vector.push(CometInfoElliptical {
49 name: "Encke".to_string(),
50 epoch: 1974.32,
51 peri: 160.1,
52 node: 334.2,
53 period: 3.3,
54 axis: 2.21,
55 ecc: 0.85,
56 incl: 12.0,
57 });
58
59 comet_elliptical_vector.push(CometInfoElliptical {
60 name: "Temple 2".to_string(),
61 epoch: 1972.87,
62 peri: 310.2,
63 node: 119.3,
64 period: 5.26,
65 axis: 3.02,
66 ecc: 0.55,
67 incl: 12.5,
68 });
69
70 comet_elliptical_vector.push(CometInfoElliptical {
71 name: "Haneda-Campos".to_string(),
72 epoch: 1978.77,
73 peri: 12.02,
74 node: 131.7,
75 period: 5.37,
76 axis: 3.07,
77 ecc: 0.64,
78 incl: 5.81,
79 });
80
81 comet_elliptical_vector.push(CometInfoElliptical {
82 name: "Schwassmann-Wachmann 2".to_string(),
83 epoch: 1974.7,
84 peri: 123.3,
85 node: 126.0,
86 period: 6.51,
87 axis: 3.49,
88 ecc: 0.39,
89 incl: 3.7,
90 });
91
92 comet_elliptical_vector.push(CometInfoElliptical {
93 name: "Borrelly".to_string(),
94 epoch: 1974.36,
95 peri: 67.8,
96 node: 75.1,
97 period: 6.76,
98 axis: 3.58,
99 ecc: 0.63,
100 incl: 30.2,
101 });
102
103 comet_elliptical_vector.push(CometInfoElliptical {
104 name: "Whipple".to_string(),
105 epoch: 1970.77,
106 peri: 18.2,
107 node: 188.4,
108 period: 7.47,
109 axis: 3.82,
110 ecc: 0.35,
111 incl: 10.2,
112 });
113
114 comet_elliptical_vector.push(CometInfoElliptical {
115 name: "Oterma".to_string(),
116 epoch: 1958.44,
117 peri: 150.0,
118 node: 155.1,
119 period: 7.88,
120 axis: 3.96,
121 ecc: 0.14,
122 incl: 4.0,
123 });
124
125 comet_elliptical_vector.push(CometInfoElliptical {
126 name: "Schaumasse".to_string(),
127 epoch: 1960.29,
128 peri: 138.1,
129 node: 86.2,
130 period: 8.18,
131 axis: 4.05,
132 ecc: 0.71,
133 incl: 12.0,
134 });
135
136 comet_elliptical_vector.push(CometInfoElliptical {
137 name: "Comas Sola".to_string(),
138 epoch: 1969.83,
139 peri: 102.9,
140 node: 62.8,
141 period: 8.55,
142 axis: 4.18,
143 ecc: 0.58,
144 incl: 13.4,
145 });
146
147 comet_elliptical_vector.push(CometInfoElliptical {
148 name: "Schwassmann-Wachmann 1".to_string(),
149 epoch: 1974.12,
150 peri: 334.1,
151 node: 319.6,
152 period: 15.03,
153 axis: 6.09,
154 ecc: 0.11,
155 incl: 9.7,
156 });
157
158 comet_elliptical_vector.push(CometInfoElliptical {
159 name: "Neujmin 1".to_string(),
160 epoch: 1966.94,
161 peri: 334.0,
162 node: 347.2,
163 period: 17.93,
164 axis: 6.86,
165 ecc: 0.78,
166 incl: 15.0,
167 });
168
169 comet_elliptical_vector.push(CometInfoElliptical {
170 name: "Crommelin".to_string(),
171 epoch: 1956.82,
172 peri: 86.4,
173 node: 250.4,
174 period: 27.89,
175 axis: 9.17,
176 ecc: 0.92,
177 incl: 28.9,
178 });
179
180 comet_elliptical_vector.push(CometInfoElliptical {
181 name: "Olbers".to_string(),
182 epoch: 1956.46,
183 peri: 150.0,
184 node: 85.4,
185 period: 69.47,
186 axis: 16.84,
187 ecc: 0.93,
188 incl: 44.6,
189 });
190
191 comet_elliptical_vector.push(CometInfoElliptical {
192 name: "Pons-Brooks".to_string(),
193 epoch: 1954.39,
194 peri: 94.2,
195 node: 255.2,
196 period: 70.98,
197 axis: 17.2,
198 ecc: 0.96,
199 incl: 74.2,
200 });
201
202 comet_elliptical_vector.push(CometInfoElliptical {
203 name: "Halley".to_string(),
204 epoch: 1986.112,
205 peri: 170.011,
206 node: 58.154,
207 period: 76.0081,
208 axis: 17.9435,
209 ecc: 0.9673,
210 incl: 162.2384,
211 });
212
213 for i in comet_elliptical_vector {
214 if i.name == comet_name {
215 return (i, "OK".to_string());
216 }
217 }
218
219 return (
220 CometInfoElliptical {
221 name: comet_name,
222 epoch: -99.0,
223 peri: -99.0,
224 node: -99.0,
225 period: -99.0,
226 axis: -99.0,
227 ecc: -99.0,
228 incl: -99.0,
229 },
230 "NotFound".to_string(),
231 );
232}
233
234pub fn get_comet_info_parabolic_vector(comet_name: String) -> (CometInfoParabolic, String) {
240 let mut comet_parabolic_vector: Vec<CometInfoParabolic> = Vec::new();
241
242 comet_parabolic_vector.push(CometInfoParabolic {
243 name: "Kohler".to_string(),
244 epoch_peri_day: 10.5659,
245 epoch_peri_month: 11,
246 epoch_peri_year: 1977,
247 arg_peri: 163.4799,
248 node: 181.8175,
249 peri_dist: 0.990662,
250 incl: 48.7196,
251 });
252
253 for i in comet_parabolic_vector {
254 if i.name == comet_name {
255 return (i, "OK".to_string());
256 }
257 }
258
259 return (
260 CometInfoParabolic {
261 name: comet_name,
262 epoch_peri_day: 0.0,
263 epoch_peri_month: 0,
264 epoch_peri_year: 0,
265 arg_peri: 0.0,
266 node: 0.0,
267 peri_dist: 0.0,
268 incl: 0.0,
269 },
270 "NotFound".to_string(),
271 );
272}