Coverage Report

Created: 2026-10-28 06:40

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.2/src/pnp/pn06a.rs
Line
Count
Source
1
use super::{nut06a, pn06};
2
3
///  Precession-nutation, IAU 2006/2000A models:  a multi-purpose function,
4
///  supporting classical (equinox-based) use directly and CIO-based use
5
///  indirectly.
6
///
7
///  This function is part of the International Astronomical Union's
8
///  SOFA (Standards of Fundamental Astronomy) software collection.
9
///
10
///  Status:  support function.
11
///
12
///  Given:
13
///     date1,date2  double          TT as a 2-part Julian Date (Note 1)
14
///
15
///  Returned (function value):
16
///     (dpsi, deps, epsa, rb, rp, rbp, rn, rbpn) (f64, f64, f64, [[f64; 3]; 3], [[f64; 3]; 3], [[f64; 3]; 3], [[f64; 3]; 3], [[f64; 3]; 3])
17
///
18
///     dpsi,deps    nutation (Note 2)
19
///     epsa         mean obliquity (Note 3)
20
///     rb           frame bias matrix (Note 4)
21
///     rp           precession matrix (Note 5)
22
///     rbp          bias-precession matrix (Note 6)
23
///     rn           nutation matrix (Note 7)
24
///     rbpn         GCRS-to-true matrix (Notes 8,9)
25
///
26
///  Notes:
27
///
28
///  1)  The TT date date1+date2 is a Julian Date, apportioned in any
29
///      convenient way between the two arguments.  For example,
30
///      JD(TT)=2450123.7 could be expressed in any of these ways,
31
///      among others:
32
///
33
///      ```text
34
///             date1          date2
35
///
36
///          2450123.7           0.0       (JD method)
37
///          2451545.0       -1421.3       (J2000 method)
38
///          2400000.5       50123.2       (MJD method)
39
///          2450123.5           0.2       (date & time method)
40
///      ```
41
///
42
///      The JD method is the most natural and convenient to use in
43
///      cases where the loss of several decimal digits of resolution
44
///      is acceptable.  The J2000 method is best matched to the way
45
///      the argument is handled internally and will deliver the
46
///      optimum resolution.  The MJD method and the date & time methods
47
///      are both good compromises between resolution and convenience.
48
///
49
///  2)  The nutation components (luni-solar + planetary, IAU 2000A) in
50
///      longitude and obliquity are in radians and with respect to the
51
///      equinox and ecliptic of date.  Free core nutation is omitted;
52
///      for the utmost accuracy, use the iauPn06 function, where the
53
///      nutation components are caller-specified.
54
///
55
///  3)  The mean obliquity is consistent with the IAU 2006 precession.
56
///
57
///  4)  The matrix rb transforms vectors from GCRS to mean J2000.0 by
58
///      applying frame bias.
59
///
60
///  5)  The matrix rp transforms vectors from mean J2000.0 to mean of
61
///      date by applying precession.
62
///
63
///  6)  The matrix rbp transforms vectors from GCRS to mean of date by
64
///      applying frame bias then precession.  It is the product rp x rb.
65
///
66
///  7)  The matrix rn transforms vectors from mean of date to true of
67
///      date by applying the nutation (luni-solar + planetary).
68
///
69
///  8)  The matrix rbpn transforms vectors from GCRS to true of date
70
///      (CIP/equinox).  It is the product rn x rbp, applying frame bias,
71
///      precession and nutation in that order.
72
///
73
///  9)  The X,Y,Z coordinates of the IAU 2006/2000A Celestial
74
///      Intermediate Pole are elements (3,1-3) of the GCRS-to-true
75
///      matrix, i.e. rbpn[2][0-2].
76
///
77
///  10) It is permissible to re-use the same array in the returned
78
///      arguments.  The arrays are filled in the stated order.
79
///
80
///  Called:
81
///     iauNut06a    nutation, IAU 2006/2000A
82
///     iauPn06      bias/precession/nutation results, IAU 2006
83
///
84
///  Reference:
85
///
86
///     Capitaine, N. & Wallace, P.T., 2006, Astron.Astrophys. 450, 855
87
0
pub fn pn06a(
88
0
    date1: f64,
89
0
    date2: f64,
90
0
) -> (
91
0
    f64,
92
0
    f64,
93
0
    f64,
94
0
    [[f64; 3]; 3],
95
0
    [[f64; 3]; 3],
96
0
    [[f64; 3]; 3],
97
0
    [[f64; 3]; 3],
98
0
    [[f64; 3]; 3],
99
0
) {
100
    /* Nutation. */
101
0
    let (dpsi, deps) = nut06a(date1, date2);
102
103
    /* Remaining results. */
104
0
    let (epsa, rb, rp, rbp, rn, rbpn) = pn06(date1, date2, dpsi, deps);
105
106
0
    (dpsi, deps, epsa, rb, rp, rbp, rn, rbpn)
107
0
}