source: trunk/FACT++/sofa/src/ld.c@ 18375

Last change on this file since 18375 was 18346, checked in by tbretz, 11 years ago
File size: 7.5 KB
Line 
1#include "sofa.h"
2
3void iauLd(double bm, double p[3], double q[3], double e[3],
4 double em, double dlim, double p1[3])
5/*
6** - - - - - -
7** i a u L d
8** - - - - - -
9**
10** Apply light deflection by a solar-system body, as part of
11** 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** bm double mass of the gravitating body (solar masses)
20** p double[3] direction from observer to source (unit vector)
21** q double[3] direction from body to source (unit vector)
22** e double[3] direction from body to observer (unit vector)
23** em double distance from body to observer (au)
24** dlim double deflection limiter (Note 4)
25**
26** Returned:
27** p1 double[3] observer to deflected source (unit vector)
28**
29** Notes:
30**
31** 1) The algorithm is based on Expr. (70) in Klioner (2003) and
32** Expr. (7.63) in the Explanatory Supplement (Urban & Seidelmann
33** 2013), with some rearrangement to minimize the effects of machine
34** precision.
35**
36** 2) The mass parameter bm can, as required, be adjusted in order to
37** allow for such effects as quadrupole field.
38**
39** 3) The barycentric position of the deflecting body should ideally
40** correspond to the time of closest approach of the light ray to
41** the body.
42**
43** 4) The deflection limiter parameter dlim is phi^2/2, where phi is
44** the angular separation (in radians) between source and body at
45** which limiting is applied. As phi shrinks below the chosen
46** threshold, the deflection is artificially reduced, reaching zero
47** for phi = 0.
48**
49** 5) The returned vector p1 is not normalized, but the consequential
50** departure from unit magnitude is always negligible.
51**
52** 6) The arguments p and p1 can be the same array.
53**
54** 7) To accumulate total light deflection taking into account the
55** contributions from several bodies, call the present function for
56** each body in succession, in decreasing order of distance from the
57** observer.
58**
59** 8) For efficiency, validation is omitted. The supplied vectors must
60** be of unit magnitude, and the deflection limiter non-zero and
61** positive.
62**
63** References:
64**
65** Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
66** the Astronomical Almanac, 3rd ed., University Science Books
67** (2013).
68**
69** Klioner, Sergei A., "A practical relativistic model for micro-
70** arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
71**
72** Called:
73** iauPdp scalar product of two p-vectors
74** iauPxp vector product of two p-vectors
75**
76** This revision: 2013 October 9
77**
78** SOFA release 2015-02-09
79**
80** Copyright (C) 2015 IAU SOFA Board. See notes at end.
81*/
82{
83 int i;
84 double qpe[3], qdqpe, w, eq[3], peq[3];
85
86/* q . (q + e). */
87 for (i = 0; i < 3; i++) {
88 qpe[i] = q[i] + e[i];
89 }
90 qdqpe = iauPdp(q, qpe);
91
92/* 2 x G x bm / ( em x c^2 x ( q . (q + e) ) ). */
93 w = bm * SRS / em / gmax(qdqpe,dlim);
94
95/* p x (e x q). */
96 iauPxp(e, q, eq);
97 iauPxp(p, eq, peq);
98
99/* Apply the deflection. */
100 for (i = 0; i < 3; i++) {
101 p1[i] = p[i] + w*peq[i];
102 }
103
104/* Finished. */
105
106/*----------------------------------------------------------------------
107**
108** Copyright (C) 2015
109** Standards Of Fundamental Astronomy Board
110** of the International Astronomical Union.
111**
112** =====================
113** SOFA Software License
114** =====================
115**
116** NOTICE TO USER:
117**
118** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
119** CONDITIONS WHICH APPLY TO ITS USE.
120**
121** 1. The Software is owned by the IAU SOFA Board ("SOFA").
122**
123** 2. Permission is granted to anyone to use the SOFA software for any
124** purpose, including commercial applications, free of charge and
125** without payment of royalties, subject to the conditions and
126** restrictions listed below.
127**
128** 3. You (the user) may copy and distribute SOFA source code to others,
129** and use and adapt its code and algorithms in your own software,
130** on a world-wide, royalty-free basis. That portion of your
131** distribution that does not consist of intact and unchanged copies
132** of SOFA source code files is a "derived work" that must comply
133** with the following requirements:
134**
135** a) Your work shall be marked or carry a statement that it
136** (i) uses routines and computations derived by you from
137** software provided by SOFA under license to you; and
138** (ii) does not itself constitute software provided by and/or
139** endorsed by SOFA.
140**
141** b) The source code of your derived work must contain descriptions
142** of how the derived work is based upon, contains and/or differs
143** from the original SOFA software.
144**
145** c) The names of all routines in your derived work shall not
146** include the prefix "iau" or "sofa" or trivial modifications
147** thereof such as changes of case.
148**
149** d) The origin of the SOFA components of your derived work must
150** not be misrepresented; you must not claim that you wrote the
151** original software, nor file a patent application for SOFA
152** software or algorithms embedded in the SOFA software.
153**
154** e) These requirements must be reproduced intact in any source
155** distribution and shall apply to anyone to whom you have
156** granted a further right to modify the source code of your
157** derived work.
158**
159** Note that, as originally distributed, the SOFA software is
160** intended to be a definitive implementation of the IAU standards,
161** and consequently third-party modifications are discouraged. All
162** variations, no matter how minor, must be explicitly marked as
163** such, as explained above.
164**
165** 4. You shall not cause the SOFA software to be brought into
166** disrepute, either by misuse, or use for inappropriate tasks, or
167** by inappropriate modification.
168**
169** 5. The SOFA software is provided "as is" and SOFA makes no warranty
170** as to its use or performance. SOFA does not and cannot warrant
171** the performance or results which the user may obtain by using the
172** SOFA software. SOFA makes no warranties, express or implied, as
173** to non-infringement of third party rights, merchantability, or
174** fitness for any particular purpose. In no event will SOFA be
175** liable to the user for any consequential, incidental, or special
176** damages, including any lost profits or lost savings, even if a
177** SOFA representative has been advised of such damages, or for any
178** claim by any third party.
179**
180** 6. The provision of any version of the SOFA software under the terms
181** and conditions specified herein does not imply that future
182** versions will also be made available under the same terms and
183** conditions.
184*
185** In any published work or commercial product which uses the SOFA
186** software directly, acknowledgement (see www.iausofa.org) is
187** appreciated.
188**
189** Correspondence concerning SOFA software should be addressed as
190** follows:
191**
192** By email: sofa@ukho.gov.uk
193** By post: IAU SOFA Center
194** HM Nautical Almanac Office
195** UK Hydrographic Office
196** Admiralty Way, Taunton
197** Somerset, TA1 2DN
198** United Kingdom
199**
200**--------------------------------------------------------------------*/
201
202}
Note: See TracBrowser for help on using the repository browser.