/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.2/src/pnp/c2tpe.rs
Line | Count | Source |
1 | | use crate::erst::{ee00, gmst00}; |
2 | | use crate::pnp::{c2teqx, pn00, pom00, sp00}; |
3 | | |
4 | | /// Form the celestial to terrestrial matrix given the date, the UT1, |
5 | | /// the nutation and the polar motion. IAU 2000. |
6 | | /// |
7 | | /// Given: |
8 | | /// tta,ttb f64 TT as a 2-part Julian Date (Note 1) |
9 | | /// uta,utb f64 UT1 as a 2-part Julian Date (Note 1) |
10 | | /// dpsi,deps f64 nutation (Note 2) |
11 | | /// xp,yp f64 coordinates of the pole (radians, Note 3) |
12 | | /// |
13 | | /// Returned: |
14 | | /// rc2t [[f64; 3]; 3] celestial-to-terrestrial matrix (Note 4) |
15 | | /// |
16 | | /// Notes: |
17 | | /// |
18 | | /// 1) The TT and UT1 dates tta+ttb and uta+utb are Julian Dates, |
19 | | /// apportioned in any convenient way between the arguments uta and |
20 | | /// utb. For example, JD(UT1)=2450123.7 could be expressed in any of |
21 | | /// these ways, among others: |
22 | | /// |
23 | | /// ```text |
24 | | /// uta utb |
25 | | /// |
26 | | /// 2450123.7 0.0 (JD method) |
27 | | /// 2451545.0 -1421.3 (J2000 method) |
28 | | /// 2400000.5 50123.2 (MJD method) |
29 | | /// 2450123.5 0.2 (date & time method) |
30 | | /// ``` |
31 | | /// |
32 | | /// The JD method is the most natural and convenient to use in |
33 | | /// cases where the loss of several decimal digits of resolution is |
34 | | /// acceptable. The J2000 and MJD methods are good compromises |
35 | | /// between resolution and convenience. In the case of uta,utb, the |
36 | | /// date & time method is best matched to the Earth rotation angle |
37 | | /// algorithm used: maximum precision is delivered when the uta |
38 | | /// argument is for 0hrs UT1 on the day in question and the utb |
39 | | /// argument lies in the range 0 to 1, or vice versa. |
40 | | /// |
41 | | /// 2) The caller is responsible for providing the nutation components; |
42 | | /// they are in longitude and obliquity, in radians and are with |
43 | | /// respect to the equinox and ecliptic of date. For high-accuracy |
44 | | /// applications, free core nutation should be included as well as |
45 | | /// any other relevant corrections to the position of the CIP. |
46 | | /// |
47 | | /// 3) The arguments xp and yp are the coordinates (in radians) of the |
48 | | /// Celestial Intermediate Pole with respect to the International |
49 | | /// Terrestrial Reference System (see IERS Conventions 2003), |
50 | | /// measured along the meridians 0 and 90 deg west respectively. |
51 | | /// |
52 | | /// 4) The matrix rc2t transforms from celestial to terrestrial |
53 | | /// coordinates: |
54 | | /// |
55 | | /// [TRS] = RPOM * R_3(GST) * RBPN * [CRS] |
56 | | /// |
57 | | /// ```text |
58 | | /// = rc2t * [CRS] |
59 | | /// ``` |
60 | | /// |
61 | | /// where [CRS] is a vector in the Geocentric Celestial Reference |
62 | | /// System and [TRS] is a vector in the International Terrestrial |
63 | | /// Reference System (see IERS Conventions 2003), RBPN is the |
64 | | /// bias-precession-nutation matrix, GST is the Greenwich (apparent) |
65 | | /// Sidereal Time and RPOM is the polar motion matrix. |
66 | | /// |
67 | | /// 5) Although its name does not include "00", This function is in fact |
68 | | /// specific to the IAU 2000 models. |
69 | | /// |
70 | | /// Called: |
71 | | /// iauPn00 bias/precession/nutation results, IAU 2000 |
72 | | /// iauGmst00 Greenwich mean sidereal time, IAU 2000 |
73 | | /// iauSp00 the TIO locator s', IERS 2000 |
74 | | /// iauEe00 equation of the equinoxes, IAU 2000 |
75 | | /// iauPom00 polar motion matrix |
76 | | /// iauC2teqx form equinox-based celestial-to-terrestrial matrix |
77 | | /// |
78 | | /// Reference: |
79 | | /// |
80 | | /// McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), |
81 | | /// IERS Technical Note No. 32, BKG (2004) |
82 | 0 | pub fn c2tpe( |
83 | 0 | tta: f64, |
84 | 0 | ttb: f64, |
85 | 0 | uta: f64, |
86 | 0 | utb: f64, |
87 | 0 | dpsi: f64, |
88 | 0 | deps: f64, |
89 | 0 | xp: f64, |
90 | 0 | yp: f64, |
91 | 0 | ) -> [[f64; 3]; 3] { |
92 | | /* Form the celestial-to-true matrix for this TT. */ |
93 | 0 | let (epsa, _, _, _, _, rbpn) = pn00(tta, ttb, dpsi, deps); |
94 | | |
95 | | /* Predict the Greenwich Mean Sidereal Time for this UT1 and TT. */ |
96 | 0 | let gmst = gmst00(uta, utb, tta, ttb); |
97 | | |
98 | | /* Predict the equation of the equinoxes given TT and nutation. */ |
99 | 0 | let ee = ee00(tta, ttb, epsa, dpsi); |
100 | | |
101 | | /* Estimate s'. */ |
102 | 0 | let sp = sp00(tta, ttb); |
103 | | |
104 | | /* Form the polar motion matrix. */ |
105 | 0 | let rpom = pom00(xp, yp, sp); |
106 | | |
107 | | /* Combine to form the celestial-to-terrestrial matrix. */ |
108 | 0 | c2teqx(&rbpn, gmst + ee, &rpom) |
109 | 0 | } |