source: trunk/FACT++/erfa/src/ld.c@ 18348

Last change on this file since 18348 was 18348, checked in by tbretz, 9 years ago
File size: 6.1 KB
Line 
1#include "erfa.h"
2
3void eraLd(double bm, double p[3], double q[3], double e[3],
4 double em, double dlim, double p1[3])
5/*
6** - - - - - -
7** e r a 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** Given:
14** bm double mass of the gravitating body (solar masses)
15** p double[3] direction from observer to source (unit vector)
16** q double[3] direction from body to source (unit vector)
17** e double[3] direction from body to observer (unit vector)
18** em double distance from body to observer (au)
19** dlim double deflection limiter (Note 4)
20**
21** Returned:
22** p1 double[3] observer to deflected source (unit vector)
23**
24** Notes:
25**
26** 1) The algorithm is based on Expr. (70) in Klioner (2003) and
27** Expr. (7.63) in the Explanatory Supplement (Urban & Seidelmann
28** 2013), with some rearrangement to minimize the effects of machine
29** precision.
30**
31** 2) The mass parameter bm can, as required, be adjusted in order to
32** allow for such effects as quadrupole field.
33**
34** 3) The barycentric position of the deflecting body should ideally
35** correspond to the time of closest approach of the light ray to
36** the body.
37**
38** 4) The deflection limiter parameter dlim is phi^2/2, where phi is
39** the angular separation (in radians) between source and body at
40** which limiting is applied. As phi shrinks below the chosen
41** threshold, the deflection is artificially reduced, reaching zero
42** for phi = 0.
43**
44** 5) The returned vector p1 is not normalized, but the consequential
45** departure from unit magnitude is always negligible.
46**
47** 6) The arguments p and p1 can be the same array.
48**
49** 7) To accumulate total light deflection taking into account the
50** contributions from several bodies, call the present function for
51** each body in succession, in decreasing order of distance from the
52** observer.
53**
54** 8) For efficiency, validation is omitted. The supplied vectors must
55** be of unit magnitude, and the deflection limiter non-zero and
56** positive.
57**
58** References:
59**
60** Urban, S. & Seidelmann, P. K. (eds), Explanatory Supplement to
61** the Astronomical Almanac, 3rd ed., University Science Books
62** (2013).
63**
64** Klioner, Sergei A., "A practical relativistic model for micro-
65** arcsecond astrometry in space", Astr. J. 125, 1580-1597 (2003).
66**
67** Called:
68** eraPdp scalar product of two p-vectors
69** eraPxp vector product of two p-vectors
70**
71** Copyright (C) 2013-2015, NumFOCUS Foundation.
72** Derived, with permission, from the SOFA library. See notes at end of file.
73*/
74{
75 int i;
76 double qpe[3], qdqpe, w, eq[3], peq[3];
77
78/* q . (q + e). */
79 for (i = 0; i < 3; i++) {
80 qpe[i] = q[i] + e[i];
81 }
82 qdqpe = eraPdp(q, qpe);
83
84/* 2 x G x bm / ( em x c^2 x ( q . (q + e) ) ). */
85 w = bm * ERFA_SRS / em / ERFA_GMAX(qdqpe,dlim);
86
87/* p x (e x q). */
88 eraPxp(e, q, eq);
89 eraPxp(p, eq, peq);
90
91/* Apply the deflection. */
92 for (i = 0; i < 3; i++) {
93 p1[i] = p[i] + w*peq[i];
94 }
95
96/* Finished. */
97
98}
99/*----------------------------------------------------------------------
100**
101**
102** Copyright (C) 2013-2015, NumFOCUS Foundation.
103** All rights reserved.
104**
105** This library is derived, with permission, from the International
106** Astronomical Union's "Standards of Fundamental Astronomy" library,
107** available from http://www.iausofa.org.
108**
109** The ERFA version is intended to retain identical functionality to
110** the SOFA library, but made distinct through different function and
111** file names, as set out in the SOFA license conditions. The SOFA
112** original has a role as a reference standard for the IAU and IERS,
113** and consequently redistribution is permitted only in its unaltered
114** state. The ERFA version is not subject to this restriction and
115** therefore can be included in distributions which do not support the
116** concept of "read only" software.
117**
118** Although the intent is to replicate the SOFA API (other than
119** replacement of prefix names) and results (with the exception of
120** bugs; any that are discovered will be fixed), SOFA is not
121** responsible for any errors found in this version of the library.
122**
123** If you wish to acknowledge the SOFA heritage, please acknowledge
124** that you are using a library derived from SOFA, rather than SOFA
125** itself.
126**
127**
128** TERMS AND CONDITIONS
129**
130** Redistribution and use in source and binary forms, with or without
131** modification, are permitted provided that the following conditions
132** are met:
133**
134** 1 Redistributions of source code must retain the above copyright
135** notice, this list of conditions and the following disclaimer.
136**
137** 2 Redistributions in binary form must reproduce the above copyright
138** notice, this list of conditions and the following disclaimer in
139** the documentation and/or other materials provided with the
140** distribution.
141**
142** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
143** the International Astronomical Union nor the names of its
144** contributors may be used to endorse or promote products derived
145** from this software without specific prior written permission.
146**
147** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
148** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
149** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
150** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
151** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
152** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
153** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
154** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
155** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
156** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
157** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
158** POSSIBILITY OF SUCH DAMAGE.
159**
160*/
Note: See TracBrowser for help on using the repository browser.