| 1 | #include "sofa.h"
|
|---|
| 2 |
|
|---|
| 3 | void iauLdn(int n, iauLDBODY b[], double ob[3], double sc[3],
|
|---|
| 4 | double sn[3])
|
|---|
| 5 | /*+
|
|---|
| 6 | ** - - - - - - -
|
|---|
| 7 | ** i a u L d n
|
|---|
| 8 | ** - - - - - - -
|
|---|
| 9 | **
|
|---|
| 10 | ** For a star, apply light deflection by multiple solar-system bodies,
|
|---|
| 11 | ** as part of transforming coordinate direction into natural direction.
|
|---|
| 12 | **
|
|---|
| 13 | ** This function is part of the International Astronomical Union's
|
|---|
| 14 | ** SOFA (Standards of Fundamental Astronomy) software collection.
|
|---|
| 15 | **
|
|---|
| 16 | ** Status: support function.
|
|---|
| 17 | **
|
|---|
| 18 | ** Given:
|
|---|
| 19 | ** n int number of bodies (note 1)
|
|---|
| 20 | ** b iauLDBODY[n] data for each of the n bodies (Notes 1,2):
|
|---|
| 21 | ** bm double mass of the body (solar masses, Note 3)
|
|---|
| 22 | ** dl double deflection limiter (Note 4)
|
|---|
| 23 | ** pv [2][3] barycentric PV of the body (au, au/day)
|
|---|
| 24 | ** ob double[3] barycentric position of the observer (au)
|
|---|
| 25 | ** sc double[3] observer to star coord direction (unit vector)
|
|---|
| 26 | **
|
|---|
| 27 | ** Returned:
|
|---|
| 28 | ** sn double[3] observer to deflected star (unit vector)
|
|---|
| 29 | **
|
|---|
| 30 | ** 1) The array b contains n entries, one for each body to be
|
|---|
| 31 | ** considered. If n = 0, no gravitational light deflection will be
|
|---|
| 32 | ** applied, not even for the Sun.
|
|---|
| 33 | **
|
|---|
| 34 | ** 2) The array b should include an entry for the Sun as well as for
|
|---|
| 35 | ** any planet or other body to be taken into account. The entries
|
|---|
| 36 | ** should be in the order in which the light passes the body.
|
|---|
| 37 | **
|
|---|
| 38 | ** 3) In the entry in the b array for body i, the mass parameter
|
|---|
| 39 | ** b[i].bm can, as required, be adjusted in order to allow for such
|
|---|
| 40 | ** effects as quadrupole field.
|
|---|
| 41 | **
|
|---|
| 42 | ** 4) The deflection limiter parameter b[i].dl is phi^2/2, where phi is
|
|---|
| 43 | ** the angular separation (in radians) between star and body at
|
|---|
| 44 | ** which limiting is applied. As phi shrinks below the chosen
|
|---|
| 45 | ** threshold, the deflection is artificially reduced, reaching zero
|
|---|
| 46 | ** for phi = 0. Example values suitable for a terrestrial
|
|---|
| 47 | ** observer, together with masses, are as follows:
|
|---|
| 48 | **
|
|---|
| 49 | ** body i b[i].bm b[i].dl
|
|---|
| 50 | **
|
|---|
| 51 | ** Sun 1.0 6e-6
|
|---|
| 52 | ** Jupiter 0.00095435 3e-9
|
|---|
| 53 | ** Saturn 0.00028574 3e-10
|
|---|
| 54 | **
|
|---|
| 55 | ** 5) For cases where the starlight passes the body before reaching the
|
|---|
| 56 | ** observer, the body is placed back along its barycentric track by
|
|---|
| 57 | ** the light time from that point to the observer. For cases where
|
|---|
| 58 | ** the body is "behind" the observer no such shift is applied. If
|
|---|
| 59 | ** a different treatment is preferred, the user has the option of
|
|---|
| 60 | ** instead using the iauLd function. Similarly, iauLd can be used
|
|---|
| 61 | ** for cases where the source is nearby, not a star.
|
|---|
| 62 | **
|
|---|
| 63 | ** 6) The returned vector sn is not normalized, but the consequential
|
|---|
| 64 | ** departure from unit magnitude is always negligible.
|
|---|
| 65 | **
|
|---|
| 66 | ** 7) The arguments sc and sn can be the same array.
|
|---|
| 67 | **
|
|---|
| 68 | ** 8) For efficiency, validation is omitted. The supplied masses must
|
|---|
| 69 | ** be greater than zero, the position and velocity vectors must be
|
|---|
| 70 | ** right, and the deflection limiter greater than zero.
|
|---|
| 71 | **
|
|---|
| 72 | ** Reference:
|
|---|
| 73 | **
|
|---|
| 74 | ** Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
|
|---|
| 75 | ** the Astronomical Almanac, 3rd ed., University Science Books
|
|---|
| 76 | ** (2013), Section 7.2.4.
|
|---|
| 77 | **
|
|---|
| 78 | ** Called:
|
|---|
| 79 | ** iauCp copy p-vector
|
|---|
| 80 | ** iauPdp scalar product of two p-vectors
|
|---|
| 81 | ** iauPmp p-vector minus p-vector
|
|---|
| 82 | ** iauPpsp p-vector plus scaled p-vector
|
|---|
| 83 | ** iauPn decompose p-vector into modulus and direction
|
|---|
| 84 | ** iauLd light deflection by a solar-system body
|
|---|
| 85 | **
|
|---|
| 86 | ** This revision: 2013 October 9
|
|---|
| 87 | **
|
|---|
| 88 | ** SOFA release 2015-02-09
|
|---|
| 89 | **
|
|---|
| 90 | ** Copyright (C) 2015 IAU SOFA Board. See notes at end.
|
|---|
| 91 | */
|
|---|
| 92 | {
|
|---|
| 93 | /* Light time for 1 AU (days) */
|
|---|
| 94 | const double CR = AULT/DAYSEC;
|
|---|
| 95 |
|
|---|
| 96 | int i;
|
|---|
| 97 | double v[3], dt, ev[3], em, e[3];
|
|---|
| 98 |
|
|---|
| 99 | /* Star direction prior to deflection. */
|
|---|
| 100 | iauCp(sc, sn);
|
|---|
| 101 |
|
|---|
| 102 | /* Body by body. */
|
|---|
| 103 | for ( i = 0; i < n; i++ ) {
|
|---|
| 104 |
|
|---|
| 105 | /* Body to observer vector at epoch of observation (au). */
|
|---|
| 106 | iauPmp ( ob, b[i].pv[0], v );
|
|---|
| 107 |
|
|---|
| 108 | /* Minus the time since the light passed the body (days). */
|
|---|
| 109 | dt = iauPdp(sn,v) * CR;
|
|---|
| 110 |
|
|---|
| 111 | /* Neutralize if the star is "behind" the observer. */
|
|---|
| 112 | dt = gmin(dt, 0.0);
|
|---|
| 113 |
|
|---|
| 114 | /* Backtrack the body to the time the light was passing the body. */
|
|---|
| 115 | iauPpsp(v, -dt, b[i].pv[1], ev);
|
|---|
| 116 |
|
|---|
| 117 | /* Body to observer vector as magnitude and direction. */
|
|---|
| 118 | iauPn(ev, &em, e);
|
|---|
| 119 |
|
|---|
| 120 | /* Apply light deflection for this body. */
|
|---|
| 121 | iauLd ( b[i].bm, sn, sn, e, em, b[i].dl, sn );
|
|---|
| 122 |
|
|---|
| 123 | /* Next body. */
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | /* Finished. */
|
|---|
| 127 |
|
|---|
| 128 | /*----------------------------------------------------------------------
|
|---|
| 129 | **
|
|---|
| 130 | ** Copyright (C) 2015
|
|---|
| 131 | ** Standards Of Fundamental Astronomy Board
|
|---|
| 132 | ** of the International Astronomical Union.
|
|---|
| 133 | **
|
|---|
| 134 | ** =====================
|
|---|
| 135 | ** SOFA Software License
|
|---|
| 136 | ** =====================
|
|---|
| 137 | **
|
|---|
| 138 | ** NOTICE TO USER:
|
|---|
| 139 | **
|
|---|
| 140 | ** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
|
|---|
| 141 | ** CONDITIONS WHICH APPLY TO ITS USE.
|
|---|
| 142 | **
|
|---|
| 143 | ** 1. The Software is owned by the IAU SOFA Board ("SOFA").
|
|---|
| 144 | **
|
|---|
| 145 | ** 2. Permission is granted to anyone to use the SOFA software for any
|
|---|
| 146 | ** purpose, including commercial applications, free of charge and
|
|---|
| 147 | ** without payment of royalties, subject to the conditions and
|
|---|
| 148 | ** restrictions listed below.
|
|---|
| 149 | **
|
|---|
| 150 | ** 3. You (the user) may copy and distribute SOFA source code to others,
|
|---|
| 151 | ** and use and adapt its code and algorithms in your own software,
|
|---|
| 152 | ** on a world-wide, royalty-free basis. That portion of your
|
|---|
| 153 | ** distribution that does not consist of intact and unchanged copies
|
|---|
| 154 | ** of SOFA source code files is a "derived work" that must comply
|
|---|
| 155 | ** with the following requirements:
|
|---|
| 156 | **
|
|---|
| 157 | ** a) Your work shall be marked or carry a statement that it
|
|---|
| 158 | ** (i) uses routines and computations derived by you from
|
|---|
| 159 | ** software provided by SOFA under license to you; and
|
|---|
| 160 | ** (ii) does not itself constitute software provided by and/or
|
|---|
| 161 | ** endorsed by SOFA.
|
|---|
| 162 | **
|
|---|
| 163 | ** b) The source code of your derived work must contain descriptions
|
|---|
| 164 | ** of how the derived work is based upon, contains and/or differs
|
|---|
| 165 | ** from the original SOFA software.
|
|---|
| 166 | **
|
|---|
| 167 | ** c) The names of all routines in your derived work shall not
|
|---|
| 168 | ** include the prefix "iau" or "sofa" or trivial modifications
|
|---|
| 169 | ** thereof such as changes of case.
|
|---|
| 170 | **
|
|---|
| 171 | ** d) The origin of the SOFA components of your derived work must
|
|---|
| 172 | ** not be misrepresented; you must not claim that you wrote the
|
|---|
| 173 | ** original software, nor file a patent application for SOFA
|
|---|
| 174 | ** software or algorithms embedded in the SOFA software.
|
|---|
| 175 | **
|
|---|
| 176 | ** e) These requirements must be reproduced intact in any source
|
|---|
| 177 | ** distribution and shall apply to anyone to whom you have
|
|---|
| 178 | ** granted a further right to modify the source code of your
|
|---|
| 179 | ** derived work.
|
|---|
| 180 | **
|
|---|
| 181 | ** Note that, as originally distributed, the SOFA software is
|
|---|
| 182 | ** intended to be a definitive implementation of the IAU standards,
|
|---|
| 183 | ** and consequently third-party modifications are discouraged. All
|
|---|
| 184 | ** variations, no matter how minor, must be explicitly marked as
|
|---|
| 185 | ** such, as explained above.
|
|---|
| 186 | **
|
|---|
| 187 | ** 4. You shall not cause the SOFA software to be brought into
|
|---|
| 188 | ** disrepute, either by misuse, or use for inappropriate tasks, or
|
|---|
| 189 | ** by inappropriate modification.
|
|---|
| 190 | **
|
|---|
| 191 | ** 5. The SOFA software is provided "as is" and SOFA makes no warranty
|
|---|
| 192 | ** as to its use or performance. SOFA does not and cannot warrant
|
|---|
| 193 | ** the performance or results which the user may obtain by using the
|
|---|
| 194 | ** SOFA software. SOFA makes no warranties, express or implied, as
|
|---|
| 195 | ** to non-infringement of third party rights, merchantability, or
|
|---|
| 196 | ** fitness for any particular purpose. In no event will SOFA be
|
|---|
| 197 | ** liable to the user for any consequential, incidental, or special
|
|---|
| 198 | ** damages, including any lost profits or lost savings, even if a
|
|---|
| 199 | ** SOFA representative has been advised of such damages, or for any
|
|---|
| 200 | ** claim by any third party.
|
|---|
| 201 | **
|
|---|
| 202 | ** 6. The provision of any version of the SOFA software under the terms
|
|---|
| 203 | ** and conditions specified herein does not imply that future
|
|---|
| 204 | ** versions will also be made available under the same terms and
|
|---|
| 205 | ** conditions.
|
|---|
| 206 | *
|
|---|
| 207 | ** In any published work or commercial product which uses the SOFA
|
|---|
| 208 | ** software directly, acknowledgement (see www.iausofa.org) is
|
|---|
| 209 | ** appreciated.
|
|---|
| 210 | **
|
|---|
| 211 | ** Correspondence concerning SOFA software should be addressed as
|
|---|
| 212 | ** follows:
|
|---|
| 213 | **
|
|---|
| 214 | ** By email: sofa@ukho.gov.uk
|
|---|
| 215 | ** By post: IAU SOFA Center
|
|---|
| 216 | ** HM Nautical Almanac Office
|
|---|
| 217 | ** UK Hydrographic Office
|
|---|
| 218 | ** Admiralty Way, Taunton
|
|---|
| 219 | ** Somerset, TA1 2DN
|
|---|
| 220 | ** United Kingdom
|
|---|
| 221 | **
|
|---|
| 222 | **--------------------------------------------------------------------*/
|
|---|
| 223 |
|
|---|
| 224 | }
|
|---|