File Coverage

erfasrc/src/pb06.c
Criterion Covered Total %
statement 0 9 0.0
branch 0 2 0.0
condition n/a
subroutine n/a
pod n/a
total 0 11 0.0


line stmt bran cond sub pod time code
1             #include "erfa.h"
2              
3 0           void eraPb06(double date1, double date2,
4             double *bzeta, double *bz, double *btheta)
5             /*
6             ** - - - - - - - -
7             ** e r a P b 0 6
8             ** - - - - - - - -
9             **
10             ** This function forms three Euler angles which implement general
11             ** precession from epoch J2000.0, using the IAU 2006 model. Frame
12             ** bias (the offset between ICRS and mean J2000.0) is included.
13             **
14             ** Given:
15             ** date1,date2 double TT as a 2-part Julian Date (Note 1)
16             **
17             ** Returned:
18             ** bzeta double 1st rotation: radians cw around z
19             ** bz double 3rd rotation: radians cw around z
20             ** btheta double 2nd rotation: radians ccw around y
21             **
22             ** Notes:
23             **
24             ** 1) The TT date date1+date2 is a Julian Date, apportioned in any
25             ** convenient way between the two arguments. For example,
26             ** JD(TT)=2450123.7 could be expressed in any of these ways,
27             ** among others:
28             **
29             ** date1 date2
30             **
31             ** 2450123.7 0.0 (JD method)
32             ** 2451545.0 -1421.3 (J2000 method)
33             ** 2400000.5 50123.2 (MJD method)
34             ** 2450123.5 0.2 (date & time method)
35             **
36             ** The JD method is the most natural and convenient to use in
37             ** cases where the loss of several decimal digits of resolution
38             ** is acceptable. The J2000 method is best matched to the way
39             ** the argument is handled internally and will deliver the
40             ** optimum resolution. The MJD method and the date & time methods
41             ** are both good compromises between resolution and convenience.
42             **
43             ** 2) The traditional accumulated precession angles zeta_A, z_A,
44             ** theta_A cannot be obtained in the usual way, namely through
45             ** polynomial expressions, because of the frame bias. The latter
46             ** means that two of the angles undergo rapid changes near this
47             ** date. They are instead the results of decomposing the
48             ** precession-bias matrix obtained by using the Fukushima-Williams
49             ** method, which does not suffer from the problem. The
50             ** decomposition returns values which can be used in the
51             ** conventional formulation and which include frame bias.
52             **
53             ** 3) The three angles are returned in the conventional order, which
54             ** is not the same as the order of the corresponding Euler
55             ** rotations. The precession-bias matrix is
56             ** R_3(-z) x R_2(+theta) x R_3(-zeta).
57             **
58             ** 4) Should zeta_A, z_A, theta_A angles be required that do not
59             ** contain frame bias, they are available by calling the ERFA
60             ** function eraP06e.
61             **
62             ** Called:
63             ** eraPmat06 PB matrix, IAU 2006
64             ** eraRz rotate around Z-axis
65             **
66             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
67             ** Derived, with permission, from the SOFA library. See notes at end of file.
68             */
69             {
70             double r[3][3], r31, r32;
71              
72              
73             /* Precession matrix via Fukushima-Williams angles. */
74 0           eraPmat06(date1, date2, r);
75              
76             /* Solve for z. */
77 0           *bz = atan2(r[1][2], r[0][2]);
78              
79             /* Remove it from the matrix. */
80 0           eraRz(*bz, r);
81              
82             /* Solve for the remaining two angles. */
83 0           *bzeta = atan2 (r[1][0], r[1][1]);
84 0           r31 = r[2][0];
85 0           r32 = r[2][1];
86 0 0         *btheta = atan2(-ERFA_DSIGN(sqrt(r31 * r31 + r32 * r32), r[0][2]),
87             r[2][2]);
88              
89 0           return;
90              
91             }
92             /*----------------------------------------------------------------------
93             **
94             **
95             ** Copyright (C) 2013-2019, NumFOCUS Foundation.
96             ** All rights reserved.
97             **
98             ** This library is derived, with permission, from the International
99             ** Astronomical Union's "Standards of Fundamental Astronomy" library,
100             ** available from http://www.iausofa.org.
101             **
102             ** The ERFA version is intended to retain identical functionality to
103             ** the SOFA library, but made distinct through different function and
104             ** file names, as set out in the SOFA license conditions. The SOFA
105             ** original has a role as a reference standard for the IAU and IERS,
106             ** and consequently redistribution is permitted only in its unaltered
107             ** state. The ERFA version is not subject to this restriction and
108             ** therefore can be included in distributions which do not support the
109             ** concept of "read only" software.
110             **
111             ** Although the intent is to replicate the SOFA API (other than
112             ** replacement of prefix names) and results (with the exception of
113             ** bugs; any that are discovered will be fixed), SOFA is not
114             ** responsible for any errors found in this version of the library.
115             **
116             ** If you wish to acknowledge the SOFA heritage, please acknowledge
117             ** that you are using a library derived from SOFA, rather than SOFA
118             ** itself.
119             **
120             **
121             ** TERMS AND CONDITIONS
122             **
123             ** Redistribution and use in source and binary forms, with or without
124             ** modification, are permitted provided that the following conditions
125             ** are met:
126             **
127             ** 1 Redistributions of source code must retain the above copyright
128             ** notice, this list of conditions and the following disclaimer.
129             **
130             ** 2 Redistributions in binary form must reproduce the above copyright
131             ** notice, this list of conditions and the following disclaimer in
132             ** the documentation and/or other materials provided with the
133             ** distribution.
134             **
135             ** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
136             ** the International Astronomical Union nor the names of its
137             ** contributors may be used to endorse or promote products derived
138             ** from this software without specific prior written permission.
139             **
140             ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
141             ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
142             ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
143             ** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
144             ** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
145             ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
146             ** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
147             ** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
148             ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
149             ** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
150             ** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
151             ** POSSIBILITY OF SUCH DAMAGE.
152             **
153             */