/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/star/fk54z.rs
Line | Count | Source |
1 | | use crate::star::fk524; |
2 | | use crate::vm::{anp, c2s, s2c}; |
3 | | |
4 | | /// Convert a J2000.0 FK5 star position to B1950.0 FK4, assuming zero |
5 | | /// proper motion in FK5 and parallax. |
6 | | /// |
7 | | /// Status: support function. |
8 | | /// |
9 | | /// Given: |
10 | | /// r2000,d2000 f64 J2000.0 FK5 RA,Dec (rad) |
11 | | /// bepoch f64 Besselian epoch (e.g. 1950.0) |
12 | | /// |
13 | | /// Returned: |
14 | | /// r1950,d1950 f64 B1950.0 FK4 RA,Dec (rad) at epoch BEPOCH |
15 | | /// dr1950,dd1950 f64 B1950.0 FK4 proper motions (rad/trop.yr) |
16 | | /// |
17 | | /// Notes: |
18 | | /// |
19 | | /// 1) In contrast to the fk524 function, here the FK5 proper |
20 | | /// motions, the parallax and the radial velocity are presumed zero. |
21 | | /// |
22 | | /// 2) This function converts a star position from the IAU 1976 FK5 |
23 | | /// (Fricke) system to the former FK4 (Bessel-Newcomb) system, for |
24 | | /// cases such as distant radio sources where it is presumed there is |
25 | | /// zero parallax and no proper motion. Because of the E-terms of |
26 | | /// aberration, such objects have (in general) non-zero proper motion |
27 | | /// in FK4, and the present function returns those fictitious proper |
28 | | /// motions. |
29 | | /// |
30 | | /// 3) Conversion from J2000.0 FK5 to B1950.0 FK4 only is provided for. |
31 | | /// Conversions involving other equinoxes would require additional |
32 | | /// treatment for precession. |
33 | | /// |
34 | | /// 4) The position returned by this function is in the B1950.0 FK4 |
35 | | /// reference system but at Besselian epoch bepoch. For comparison |
36 | | /// with catalogs the bepoch argument will frequently be 1950.0. (In |
37 | | /// this context the distinction between Besselian and Julian epoch |
38 | | /// is insignificant.) |
39 | | /// |
40 | | /// 5) The RA component of the returned (fictitious) proper motion is |
41 | | /// dRA/dt rather than cos(Dec)*dRA/dt. |
42 | | /// |
43 | | /// Called: |
44 | | /// anp normalize angle into range 0 to 2pi |
45 | | /// c2s p-vector to spherical |
46 | | /// fk524 FK4 to FK5 |
47 | | /// s2c spherical to p-vector |
48 | 0 | pub fn fk54z(r2000: f64, d2000: f64, bepoch: f64) -> (f64, f64, f64, f64) { |
49 | | /* FK5 equinox J2000.0 to FK4 equinox B1950.0. */ |
50 | 0 | let (r, d, pr, pd, _px, _rv) = fk524(r2000, d2000, 0.0, 0.0, 0.0, 0.0); |
51 | | |
52 | | /* Spherical to Cartesian. */ |
53 | 0 | let mut p = s2c(r, d); |
54 | | |
55 | | /* Fictitious proper motion (radians per year). */ |
56 | 0 | let mut v = [0.0; 3]; |
57 | 0 | v[0] = -pr * p[1] - pd * r.cos() * d.sin(); |
58 | 0 | v[1] = pr * p[0] - pd * r.sin() * d.sin(); |
59 | 0 | v[2] = pd * d.cos(); |
60 | | |
61 | | /* Apply the motion. */ |
62 | 0 | let w = bepoch - 1950.0; |
63 | 0 | for i in 0..3 { |
64 | 0 | p[i] += w * v[i]; |
65 | 0 | } |
66 | | |
67 | | /* Cartesian to spherical. */ |
68 | 0 | let (w_res, d1950) = c2s(&p); |
69 | 0 | let r1950 = anp(w_res); |
70 | | |
71 | | /* Fictitious proper motion. */ |
72 | 0 | (r1950, d1950, pr, pd) |
73 | 0 | } |