/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.1/src/projection/tpsts.rs
Line | Count | Source |
1 | | use crate::vm::anp; |
2 | | |
3 | | /// In the tangent plane projection, given the star's rectangular |
4 | | /// coordinates and the spherical coordinates of the tangent point, |
5 | | /// solve for the spherical coordinates of the star. |
6 | | /// |
7 | | /// Status: support function. |
8 | | /// |
9 | | /// Given: |
10 | | /// xi,eta f64 rectangular coordinates of star image (Note 2) |
11 | | /// a0,b0 f64 tangent point's spherical coordinates |
12 | | /// |
13 | | /// Returned: |
14 | | /// a,b f64 star's spherical coordinates |
15 | | /// |
16 | | /// Notes: |
17 | | /// |
18 | | /// 1) The tangent plane projection is also called the "gnomonic |
19 | | /// projection" and the "central projection". |
20 | | /// |
21 | | /// 2) The eta axis points due north in the adopted coordinate system. |
22 | | /// If the spherical coordinates are observed (RA,Dec), the tangent |
23 | | /// plane coordinates (xi,eta) are conventionally called the |
24 | | /// "standard coordinates". If the spherical coordinates are with |
25 | | /// respect to a right-handed triad, (xi,eta) are also right-handed. |
26 | | /// The units of (xi,eta) are, effectively, radians at the tangent |
27 | | /// point. |
28 | | /// |
29 | | /// 3) All angular arguments are in radians. |
30 | | /// |
31 | | /// 4) This function is a member of the following set: |
32 | | /// |
33 | | /// spherical vector solve for |
34 | | /// |
35 | | /// tpxes tpxev xi,eta |
36 | | /// > tpsts < tpstv star |
37 | | /// tpors tporv origin |
38 | | /// |
39 | | /// References: |
40 | | /// |
41 | | /// Calabretta M.R. & Greisen, E.W., 2002, "Representations of |
42 | | /// celestial coordinates in FITS", Astron.Astrophys. 395, 1077 |
43 | | /// |
44 | | /// Green, R.M., "Spherical Astronomy", Cambridge University Press, |
45 | | /// 1987, Chapter 13. |
46 | 0 | pub fn tpsts(xi: f64, eta: f64, a0: f64, b0: f64) -> (f64, f64) { |
47 | 0 | let sb0 = b0.sin(); |
48 | 0 | let cb0 = b0.cos(); |
49 | 0 | let d = cb0 - eta * sb0; |
50 | 0 | let a = anp(xi.atan2(d) + a0); |
51 | 0 | let b = (sb0 + eta * cb0).atan2((xi * xi + d * d).sqrt()); |
52 | 0 | (a, b) |
53 | 0 | } |