sofars/astro/atccq.rs
1use super::{IauAstrom, pmpx};
2use crate::vm::{anp, c2s};
3
4/// Quick catalog −> astrometric
5///
6/// Quick transformation of a star's ICRS catalog entry (epoch J2000.0)
7/// into ICRS astrometric place, given precomputed star-independent
8/// astrometry parameters.
9///
10/// Use of this function is appropriate when efficiency is important and
11/// where many star positions are to be transformed for one date. The
12/// star-independent parameters can be obtained by calling one of the
13/// functions iauApci[13], iauApcg[13], iauApco[13] or iauApcs[13].
14///
15/// If the parallax and proper motions are zero the transformation has
16/// no effect.
17///
18/// This function is part of the International Astronomical Union's
19/// SOFA (Standards of Fundamental Astronomy) software collection.
20///
21/// Status: support function.
22///
23/// Given:
24/// ```
25/// rc,dc double ICRS RA,Dec at J2000.0 (radians)
26/// pr double RA proper motion (radians/year, Note 3)
27/// pd double Dec proper motion (radians/year)
28/// px double parallax (arcsec)
29/// rv double radial velocity (km/s, +ve if receding)
30/// astrom iauASTROM* star-independent astrometry parameters:
31/// pmt double PM time interval (SSB, Julian years)
32/// eb double[3] SSB to observer (vector, au)
33/// eh double[3] Sun to observer (unit vector)
34/// em double distance from Sun to observer (au)
35/// v double[3] barycentric observer velocity (vector, c)
36/// bm1 double sqrt(1-|v|^2): reciprocal of Lorenz factor
37/// bpn double[3][3] bias-precession-nutation matrix
38/// along double longitude + s' (radians)
39/// xpl double polar motion xp wrt local meridian (radians)
40/// ypl double polar motion yp wrt local meridian (radians)
41/// sphi double sine of geodetic latitude
42/// cphi double cosine of geodetic latitude
43/// diurab double magnitude of diurnal aberration vector
44/// eral double "local" Earth rotation angle (radians)
45/// refa double refraction constant A (radians)
46/// refb double refraction constant B (radians)
47/// ```
48/// Returned:
49/// ```
50/// ra,da double* ICRS astrometric RA,Dec (radians)
51/// ```
52/// Notes:
53///
54/// 1) All the vectors are with respect to BCRS axes.
55///
56/// 2) Star data for an epoch other than J2000.0 (for example from the
57/// Hipparcos catalog, which has an epoch of J1991.25) will require a
58/// preliminary call to iauPmsafe before use.
59///
60/// 3) The proper motion in RA is dRA/dt rather than cos(Dec)*dRA/dt.
61///
62/// Called:
63/// ```
64/// iauPmpx proper motion and parallax
65/// iauC2s p-vector to spherical
66/// iauAnp normalize angle into range 0 to 2pi
67/// ```
68pub fn atccq(
69 rc: f64,
70 dc: f64,
71 pr: f64,
72 pd: f64,
73 px: f64,
74 rv: f64,
75 astrom: &IauAstrom,
76) -> (f64, f64) {
77 /* Proper motion and parallax, giving BCRS coordinate direction. */
78 let p = pmpx(rc, dc, pr, pd, px, rv, astrom.pmt, astrom.eb);
79
80 /* ICRS astrometric RA,Dec. */
81 let (w, da) = c2s(&p);
82 let ra = anp(w);
83
84 (ra, da)
85}