/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/pnp/c2teqx.rs
Line | Count | Source |
1 | | use crate::vm::{cr, rxr, rz}; |
2 | | |
3 | | /// Assemble the celestial to terrestrial matrix from equinox-based |
4 | | /// components (the celestial-to-true matrix, the Greenwich Apparent |
5 | | /// Sidereal Time and the polar motion matrix). |
6 | | /// |
7 | | /// Given: |
8 | | /// rbpn [[f64; 3]; 3] celestial-to-true matrix |
9 | | /// gst f64 Greenwich (apparent) Sidereal Time (radians) |
10 | | /// rpom [[f64; 3]; 3] polar-motion matrix |
11 | | /// |
12 | | /// Returned (function value): |
13 | | /// [[f64; 3]; 3] celestial-to-terrestrial matrix (Note 2) |
14 | | /// |
15 | | /// Notes: |
16 | | /// |
17 | | /// 1) This function constructs the rotation matrix that transforms |
18 | | /// vectors in the celestial system into vectors in the terrestrial |
19 | | /// system. It does so starting from precomputed components, namely |
20 | | /// the matrix which rotates from celestial coordinates to the |
21 | | /// true equator and equinox of date, the Greenwich Apparent Sidereal |
22 | | /// Time and the polar motion matrix. One use of the present function |
23 | | /// is when generating a series of celestial-to-terrestrial matrices |
24 | | /// where only the Sidereal Time changes, avoiding the considerable |
25 | | /// overhead of recomputing the precession-nutation more often than |
26 | | /// necessary to achieve given accuracy objectives. |
27 | | /// |
28 | | /// 2) The relationship between the arguments is as follows: |
29 | | /// |
30 | | /// [TRS] = rpom * R_3(gst) * rbpn * [CRS] |
31 | | /// |
32 | | /// = rc2t * [CRS] |
33 | | /// |
34 | | /// where [CRS] is a vector in the Geocentric Celestial Reference |
35 | | /// System and [TRS] is a vector in the International Terrestrial |
36 | | /// Reference System (see IERS Conventions 2003). |
37 | | /// |
38 | | /// Called: |
39 | | /// iauCr copy r-matrix |
40 | | /// iauRz rotate around Z-axis |
41 | | /// iauRxr product of two r-matrices |
42 | | /// |
43 | | /// Reference: |
44 | | /// |
45 | | /// McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003), |
46 | | /// IERS Technical Note No. 32, BKG (2004) |
47 | 0 | pub fn c2teqx(rbpn: &[[f64; 3]; 3], gst: f64, rpom: &[[f64; 3]; 3]) -> [[f64; 3]; 3] { |
48 | 0 | let mut r = [[0.0; 3]; 3]; |
49 | 0 | let mut rc2t = [[0.0; 3]; 3]; |
50 | | |
51 | | /* Construct the matrix. */ |
52 | 0 | cr(rbpn, &mut r); |
53 | 0 | rz(gst, &mut r); |
54 | 0 | rxr(rpom, &r, &mut rc2t); |
55 | 0 | rc2t |
56 | 0 | } |