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

Last change on this file was 18921, checked in by tbretz, 7 years ago
Updated to ERFA 1.4.0
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-2017, 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
79/* q . (q + e). */
80 for (i = 0; i < 3; i++) {
81 qpe[i] = q[i] + e[i];
82 }
83 qdqpe = eraPdp(q, qpe);
84
85/* 2 x G x bm / ( em x c^2 x ( q . (q + e) ) ). */
86 w = bm * ERFA_SRS / em / ERFA_GMAX(qdqpe,dlim);
87
88/* p x (e x q). */
89 eraPxp(e, q, eq);
90 eraPxp(p, eq, peq);
91
92/* Apply the deflection. */
93 for (i = 0; i < 3; i++) {
94 p1[i] = p[i] + w*peq[i];
95 }
96
97/* Finished. */
98
99}
100/*----------------------------------------------------------------------
101**
102**
103** Copyright (C) 2013-2017, NumFOCUS Foundation.
104** All rights reserved.
105**
106** This library is derived, with permission, from the International
107** Astronomical Union's "Standards of Fundamental Astronomy" library,
108** available from http://www.iausofa.org.
109**
110** The ERFA version is intended to retain identical functionality to
111** the SOFA library, but made distinct through different function and
112** file names, as set out in the SOFA license conditions. The SOFA
113** original has a role as a reference standard for the IAU and IERS,
114** and consequently redistribution is permitted only in its unaltered
115** state. The ERFA version is not subject to this restriction and
116** therefore can be included in distributions which do not support the
117** concept of "read only" software.
118**
119** Although the intent is to replicate the SOFA API (other than
120** replacement of prefix names) and results (with the exception of
121** bugs; any that are discovered will be fixed), SOFA is not
122** responsible for any errors found in this version of the library.
123**
124** If you wish to acknowledge the SOFA heritage, please acknowledge
125** that you are using a library derived from SOFA, rather than SOFA
126** itself.
127**
128**
129** TERMS AND CONDITIONS
130**
131** Redistribution and use in source and binary forms, with or without
132** modification, are permitted provided that the following conditions
133** are met:
134**
135** 1 Redistributions of source code must retain the above copyright
136** notice, this list of conditions and the following disclaimer.
137**
138** 2 Redistributions in binary form must reproduce the above copyright
139** notice, this list of conditions and the following disclaimer in
140** the documentation and/or other materials provided with the
141** distribution.
142**
143** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
144** the International Astronomical Union nor the names of its
145** contributors may be used to endorse or promote products derived
146** from this software without specific prior written permission.
147**
148** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
149** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
150** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
151** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
152** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
153** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
154** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
155** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
156** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
157** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
158** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
159** POSSIBILITY OF SUCH DAMAGE.
160**
161*/
Note: See TracBrowser for help on using the repository browser.