rfa/prec_nut/
ltp.rs

1use super::{ltpequ::*, ltpecl::*};
2use crate::vector_matrix::{vector_ops::{pn::*, pxp::*, }};
3///  Long-term precession matrix.
4///
5///  Given:
6///     epj     double         Julian epoch (TT)
7///
8///  Returned:
9///     rp      double[3][3]   precession matrix, J2000.0 to date
10///
11///  Notes:
12///
13///  1) The matrix is in the sense
14///
15///        P_date = rp x P_J2000,
16///
17///     where P_J2000 is a vector with respect to the J2000.0 mean
18///     equator and equinox and P_date is the same vector with respect to
19///     the equator and equinox of epoch epj.
20///
21///  2) The Vondrak et al. (2011, 2012) 400 millennia precession model
22///     agrees with the IAU 2006 precession at J2000.0 and stays within
23///     100 microarcseconds during the 20th and 21st centuries.  It is
24///     accurate to a few arcseconds throughout the historical period,
25///     worsening to a few tenths of a degree at the end of the
26///     +/- 200,000 year time span.
27///
28///  Called:
29///     eraLtpequ    equator pole, long term
30///     eraLtpecl    ecliptic pole, long term
31///     eraPxp       vector product
32///     eraPn        normalize vector
33///
34///  References:
35///
36///    Vondrak, J., Capitaine, N. and Wallace, P., 2011, New precession
37///    expressions, valid for long time intervals, Astron.Astrophys. 534,
38///    A22
39///
40///    Vondrak, J., Capitaine, N. and Wallace, P., 2012, New precession
41///    expressions, valid for long time intervals (Corrigendum),
42///    Astron.Astrophys. 541, C1
43///
44///  This revision:  2021 May 11
45pub fn ltp(epj: f64, rp: &mut[[f64;3];3])
46
47{
48    let mut peqr = [0.0; 3]; let mut pecl = [0.0; 3]; let mut v = [0.0; 3]; let mut w =0.0; 
49    let mut eqx = [0.0; 3];
50 
51 
52 /* Equator pole (bottom row of matrix). */
53    ltpequ(epj, &mut peqr);
54 
55 /* Ecliptic pole. */
56    ltpecl(epj, &mut pecl);
57 
58 /* Equinox (top row of matrix). */
59    pxp(&peqr, &pecl, &mut v);
60    pn(&v, &mut w, &mut eqx);
61 
62 /* Middle row of matrix. */
63    pxp(&peqr, &eqx, &mut v);
64 
65 /* Assemble the matrix. */
66    for i in 0..3 {
67       rp[0][i] = eqx[i];
68       rp[1][i] = v[i];
69       rp[2][i] = peqr[i];
70    }
71 
72 /* Finished. */
73 
74 }