/rust/registry/src/index.crates.io-1949cf8c6b5b557f/sofars-0.6.2/src/astro/ldsun.rs
Line | Count | Source |
1 | | use super::ld; |
2 | | |
3 | | /// Light deflection by the Sun |
4 | | /// |
5 | | /// Deflection of starlight by the Sun. |
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 | | /// ```text |
14 | | /// p double[3] direction from observer to star (unit vector) |
15 | | /// e double[3] direction from Sun to observer (unit vector) |
16 | | /// em double distance from Sun to observer (au) |
17 | | /// ``` |
18 | | /// Returned: |
19 | | /// ```text |
20 | | /// p1 double[3] observer to deflected star (unit vector) |
21 | | /// ``` |
22 | | /// |
23 | | /// Notes: |
24 | | /// |
25 | | /// 1) The source is presumed to be sufficiently distant that its |
26 | | /// directions seen from the Sun and the observer are essentially |
27 | | /// the same. |
28 | | /// |
29 | | /// 2) The deflection is restrained when the angle between the star and |
30 | | /// the center of the Sun is less than a threshold value, falling to |
31 | | /// zero deflection for zero separation. The chosen threshold value |
32 | | /// is within the solar limb for all solar-system applications, and |
33 | | /// is about 5 arcminutes for the case of a terrestrial observer. |
34 | | /// |
35 | | /// 3) The arguments p and p1 can be the same array. |
36 | | /// |
37 | | /// Called: |
38 | | /// ```text |
39 | | /// iauLd light deflection by a solar-system body |
40 | | /// ``` |
41 | 0 | pub fn ldsun(p: [f64; 3], e: [f64; 3], em: f64) -> [f64; 3] { |
42 | | /* Deflection limiter (smaller for distant observers). */ |
43 | 0 | let mut em2 = em * em; |
44 | 0 | if em2 < 1.0 { |
45 | 0 | em2 = 1.0; |
46 | 0 | } |
47 | 0 | let dlim = 1e-6 / if em2 > 1.0 { em2 } else { 1.0 }; |
48 | | |
49 | | /* Apply the deflection. */ |
50 | 0 | ld(1.0, p, p, e, em, dlim) |
51 | 0 | } |