File Coverage

erfasrc/src/bp00.c
Criterion Covered Total %
statement 0 21 0.0
branch n/a
condition n/a
subroutine n/a
pod n/a
total 0 21 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraBp00(double date1, double date2,
4             double rb[3][3], double rp[3][3], double rbp[3][3])
5             /*
6             ** - - - - - - - -
7             ** e r a B p 0 0
8             ** - - - - - - - -
9             **
10             ** Frame bias and precession, IAU 2000.
11             **
12             ** Given:
13             ** date1,date2 double TT as a 2-part Julian Date (Note 1)
14             **
15             ** Returned:
16             ** rb double[3][3] frame bias matrix (Note 2)
17             ** rp double[3][3] precession matrix (Note 3)
18             ** rbp double[3][3] bias-precession matrix (Note 4)
19             **
20             ** Notes:
21             **
22             ** 1) The TT date date1+date2 is a Julian Date, apportioned in any
23             ** convenient way between the two arguments. For example,
24             ** JD(TT)=2450123.7 could be expressed in any of these ways,
25             ** among others:
26             **
27             ** date1 date2
28             **
29             ** 2450123.7 0.0 (JD method)
30             ** 2451545.0 -1421.3 (J2000 method)
31             ** 2400000.5 50123.2 (MJD method)
32             ** 2450123.5 0.2 (date & time method)
33             **
34             ** The JD method is the most natural and convenient to use in
35             ** cases where the loss of several decimal digits of resolution
36             ** is acceptable. The J2000 method is best matched to the way
37             ** the argument is handled internally and will deliver the
38             ** optimum resolution. The MJD method and the date & time methods
39             ** are both good compromises between resolution and convenience.
40             **
41             ** 2) The matrix rb transforms vectors from GCRS to mean J2000.0 by
42             ** applying frame bias.
43             **
44             ** 3) The matrix rp transforms vectors from J2000.0 mean equator and
45             ** equinox to mean equator and equinox of date by applying
46             ** precession.
47             **
48             ** 4) The matrix rbp transforms vectors from GCRS to mean equator and
49             ** equinox of date by applying frame bias then precession. It is
50             ** the product rp x rb.
51             **
52             ** 5) It is permissible to re-use the same array in the returned
53             ** arguments. The arrays are filled in the order given.
54             **
55             ** Called:
56             ** eraBi00 frame bias components, IAU 2000
57             ** eraPr00 IAU 2000 precession adjustments
58             ** eraIr initialize r-matrix to identity
59             ** eraRx rotate around X-axis
60             ** eraRy rotate around Y-axis
61             ** eraRz rotate around Z-axis
62             ** eraCr copy r-matrix
63             ** eraRxr product of two r-matrices
64             **
65             ** Reference:
66             ** "Expressions for the Celestial Intermediate Pole and Celestial
67             ** Ephemeris Origin consistent with the IAU 2000A precession-
68             ** nutation model", Astron.Astrophys. 400, 1145-1154 (2003)
69             **
70             ** n.b. The celestial ephemeris origin (CEO) was renamed "celestial
71             ** intermediate origin" (CIO) by IAU 2006 Resolution 2.
72             **
73             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
74             ** Derived, with permission, from the SOFA library. See notes at end of file.
75             */
76             {
77             /* J2000.0 obliquity (Lieske et al. 1977) */
78             const double EPS0 = 84381.448 * ERFA_DAS2R;
79              
80             double t, dpsibi, depsbi, dra0, psia77, oma77, chia,
81             dpsipr, depspr, psia, oma, rbw[3][3];
82              
83              
84             /* Interval between fundamental epoch J2000.0 and current date (JC). */
85 0           t = ((date1 - ERFA_DJ00) + date2) / ERFA_DJC;
86              
87             /* Frame bias. */
88 0           eraBi00(&dpsibi, &depsbi, &dra0);
89              
90             /* Precession angles (Lieske et al. 1977) */
91 0           psia77 = (5038.7784 + (-1.07259 + (-0.001147) * t) * t) * t * ERFA_DAS2R;
92 0           oma77 = EPS0 + ((0.05127 + (-0.007726) * t) * t) * t * ERFA_DAS2R;
93 0           chia = ( 10.5526 + (-2.38064 + (-0.001125) * t) * t) * t * ERFA_DAS2R;
94              
95             /* Apply IAU 2000 precession corrections. */
96 0           eraPr00(date1, date2, &dpsipr, &depspr);
97 0           psia = psia77 + dpsipr;
98 0           oma = oma77 + depspr;
99              
100             /* Frame bias matrix: GCRS to J2000.0. */
101 0           eraIr(rbw);
102 0           eraRz(dra0, rbw);
103 0           eraRy(dpsibi*sin(EPS0), rbw);
104 0           eraRx(-depsbi, rbw);
105 0           eraCr(rbw, rb);
106              
107             /* Precession matrix: J2000.0 to mean of date. */
108 0           eraIr(rp);
109 0           eraRx(EPS0, rp);
110 0           eraRz(-psia, rp);
111 0           eraRx(-oma, rp);
112 0           eraRz(chia, rp);
113              
114             /* Bias-precession matrix: GCRS to mean of date. */
115 0           eraRxr(rp, rbw, rbp);
116              
117 0           return;
118              
119             }
120             /*----------------------------------------------------------------------
121             **
122             **
123             ** Copyright (C) 2013-2020, NumFOCUS Foundation.
124             ** All rights reserved.
125             **
126             ** This library is derived, with permission, from the International
127             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
128             ** available from http://www.iausofa.org.
129             **
130             ** The ERFA version is intended to retain identical functionality to
131             ** the SOFA library, but made distinct through different function and
132             ** file names, as set out in the SOFA license conditions. The SOFA
133             ** original has a role as a reference standard for the IAU and IERS,
134             ** and consequently redistribution is permitted only in its unaltered
135             ** state. The ERFA version is not subject to this restriction and
136             ** therefore can be included in distributions which do not support the
137             ** concept of "read only" software.
138             **
139             ** Although the intent is to replicate the SOFA API (other than
140             ** replacement of prefix names) and results (with the exception of
141             ** bugs; any that are discovered will be fixed), SOFA is not
142             ** responsible for any errors found in this version of the library.
143             **
144             ** If you wish to acknowledge the SOFA heritage, please acknowledge
145             ** that you are using a library derived from SOFA, rather than SOFA
146             ** itself.
147             **
148             **
149             ** TERMS AND CONDITIONS
150             **
151             ** Redistribution and use in source and binary forms, with or without
152             ** modification, are permitted provided that the following conditions
153             ** are met:
154             **
155             ** 1 Redistributions of source code must retain the above copyright
156             ** notice, this list of conditions and the following disclaimer.
157             **
158             ** 2 Redistributions in binary form must reproduce the above copyright
159             ** notice, this list of conditions and the following disclaimer in
160             ** the documentation and/or other materials provided with the
161             ** distribution.
162             **
163             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
164             ** the International Astronomical Union nor the names of its
165             ** contributors may be used to endorse or promote products derived
166             ** from this software without specific prior written permission.
167             **
168             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
169             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
170             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
171             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
172             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
173             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
174             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
175             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
176             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
177             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
178             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
179             ** POSSIBILITY OF SUCH DAMAGE.
180             **
181             */