/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.2/src/pnp/pn00.rs
Line | Count | Source |
1 | | use crate::vm::rxr; |
2 | | |
3 | | use super::{bp00, numat, obl80, pr00}; |
4 | | |
5 | | /// Bias/precession/nutation results, IAU 2000 |
6 | | /// |
7 | | /// Precession-nutation, IAU 2000 model: a multi-purpose function, |
8 | | /// supporting classical (equinox-based) use directly and CIO-based |
9 | | /// use indirectly. |
10 | | /// |
11 | | /// This function is part of the International Astronomical Union's |
12 | | /// SOFA (Standards of Fundamental Astronomy) software collection. |
13 | | /// |
14 | | /// Status: support function. |
15 | | /// |
16 | | /// Given: |
17 | | /// date1,date2 double TT as a 2-part Julian Date (Note 1) |
18 | | /// dpsi,deps double nutation (Note 2) |
19 | | /// |
20 | | /// Returned (function value): |
21 | | /// (epsa, rb, rp, rbp, rn, rbpn) (f64, [[f64; 3]; 3], [[f64; 3]; 3], [[f64; 3]; 3], [[f64; 3]; 3], [[f64; 3]; 3]) |
22 | | /// |
23 | | /// epsa mean obliquity (Note 3) |
24 | | /// rb frame bias matrix (Note 4) |
25 | | /// rp precession matrix (Note 5) |
26 | | /// rbp bias-precession matrix (Note 6) |
27 | | /// rn nutation matrix (Note 7) |
28 | | /// rbpn GCRS-to-true matrix (Note 8) |
29 | | /// |
30 | | /// Notes: |
31 | | /// |
32 | | /// 1) The TT date date1+date2 is a Julian Date, apportioned in any |
33 | | /// convenient way between the two arguments. For example, |
34 | | /// JD(TT)=2450123.7 could be expressed in any of these ways, |
35 | | /// among others: |
36 | | /// |
37 | | /// ```text |
38 | | /// date1 date2 |
39 | | /// |
40 | | /// 2450123.7 0.0 (JD method) |
41 | | /// 2451545.0 -1421.3 (J2000 method) |
42 | | /// 2400000.5 50123.2 (MJD method) |
43 | | /// 2450123.5 0.2 (date & time method) |
44 | | /// ``` |
45 | | /// |
46 | | /// The JD method is the most natural and convenient to use in |
47 | | /// cases where the loss of several decimal digits of resolution |
48 | | /// is acceptable. The J2000 method is best matched to the way |
49 | | /// the argument is handled internally and will deliver the |
50 | | /// optimum resolution. The MJD method and the date & time methods |
51 | | /// are both good compromises between resolution and convenience. |
52 | | /// |
53 | | /// 2) The caller is responsible for providing the nutation components; |
54 | | /// they are in longitude and obliquity, in radians and are with |
55 | | /// respect to the equinox and ecliptic of date. For high-accuracy |
56 | | /// applications, free core nutation should be included as well as |
57 | | /// any other relevant corrections to the position of the CIP. |
58 | | /// |
59 | | /// 3) The returned mean obliquity is consistent with the IAU 2000 |
60 | | /// precession-nutation models. |
61 | | /// |
62 | | /// 4) The matrix rb transforms vectors from GCRS to J2000.0 mean |
63 | | /// equator and equinox by applying frame bias. |
64 | | /// |
65 | | /// 5) The matrix rp transforms vectors from J2000.0 mean equator and |
66 | | /// equinox to mean equator and equinox of date by applying |
67 | | /// precession. |
68 | | /// |
69 | | /// 6) The matrix rbp transforms vectors from GCRS to mean equator and |
70 | | /// equinox of date by applying frame bias then precession. It is |
71 | | /// the product rp x rb. |
72 | | /// |
73 | | /// 7) The matrix rn transforms vectors from mean equator and equinox of |
74 | | /// date to true equator and equinox of date by applying the nutation |
75 | | /// (luni-solar + planetary). |
76 | | /// |
77 | | /// 8) The matrix rbpn transforms vectors from GCRS to true equator and |
78 | | /// equinox of date. It is the product rn x rbp, applying frame |
79 | | /// bias, precession and nutation in that order. |
80 | | /// |
81 | | /// Called: |
82 | | /// iauPr00 IAU 2000 precession adjustments |
83 | | /// iauObl80 mean obliquity, IAU 1980 |
84 | | /// iauBp00 frame bias and precession matrices, IAU 2000 |
85 | | /// iauCr copy r-matrix |
86 | | /// iauNumat form nutation matrix |
87 | | /// iauRxr product of two r-matrices |
88 | | /// |
89 | | /// Reference: |
90 | | /// |
91 | | /// Capitaine, N., Chapront, J., Lambert, S. and Wallace, P., |
92 | | /// "Expressions for the Celestial Intermediate Pole and Celestial |
93 | | /// Ephemeris Origin consistent with the IAU 2000A precession- |
94 | | /// nutation model", Astron.Astrophys. 400, 1145-1154 (2003) |
95 | | /// |
96 | | /// n.b. The celestial ephemeris origin (CEO) was renamed "celestial |
97 | | /// intermediate origin" (CIO) by IAU 2006 Resolution 2. |
98 | 0 | pub fn pn00( |
99 | 0 | date1: f64, |
100 | 0 | date2: f64, |
101 | 0 | dpsi: f64, |
102 | 0 | deps: f64, |
103 | 0 | ) -> ( |
104 | 0 | f64, |
105 | 0 | [[f64; 3]; 3], |
106 | 0 | [[f64; 3]; 3], |
107 | 0 | [[f64; 3]; 3], |
108 | 0 | [[f64; 3]; 3], |
109 | 0 | [[f64; 3]; 3], |
110 | 0 | ) { |
111 | 0 | let mut rbpn = [[0.0; 3]; 3]; |
112 | | |
113 | | /* IAU 2000 precession-rate adjustments. */ |
114 | 0 | let (_, depspr) = pr00(date1, date2); |
115 | | |
116 | | /* Mean obliquity, consistent with IAU 2000 precession-nutation. */ |
117 | 0 | let epsa = obl80(date1, date2) + depspr; |
118 | | |
119 | | /* Frame bias and precession matrices and their product. */ |
120 | 0 | let (rb, rp, rbp) = bp00(date1, date2); |
121 | | |
122 | | /* Nutation matrix. */ |
123 | 0 | let rn = numat(epsa, dpsi, deps); |
124 | | |
125 | | /* Bias-precession-nutation matrix (classical). */ |
126 | 0 | rxr(&rn, &rbp, &mut rbpn); |
127 | | |
128 | 0 | (epsa, rb, rp, rbp, rn, rbpn) |
129 | 0 | } |