| 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-2020, NumFOCUS Foundation. | 
| 67 |  |  |  |  |  |  | **  Derived, with permission, from the SOFA library.  See notes at end of file. | 
| 68 |  |  |  |  |  |  | */ | 
| 69 |  |  |  |  |  |  | { | 
| 70 |  |  |  |  |  |  | double r[3][3], y, x; | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | /* Precession matrix via Fukushima-Williams angles. */ | 
| 74 | 0 |  |  |  |  |  | eraPmat06(date1, date2, r); | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | /* Solve for z, choosing the +/- pi alternative. */ | 
| 77 | 0 |  |  |  |  |  | y = r[1][2]; | 
| 78 | 0 |  |  |  |  |  | x = -r[0][2]; | 
| 79 | 0 | 0 |  |  |  |  | if ( x < 0.0 ) { | 
| 80 | 0 |  |  |  |  |  | y = -y; | 
| 81 |  |  |  |  |  |  | x = -x; | 
| 82 |  |  |  |  |  |  | } | 
| 83 | 0 | 0 |  |  |  |  | *bz = ( x != 0.0 || y != 0.0 ) ? - atan2(y,x) : 0.0; | 
| 84 |  |  |  |  |  |  |  | 
| 85 |  |  |  |  |  |  | /* Derotate it out of the matrix. */ | 
| 86 | 0 |  |  |  |  |  | eraRz ( *bz, r ); | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | /* Solve for the remaining two angles. */ | 
| 89 | 0 |  |  |  |  |  | y = r[0][2]; | 
| 90 | 0 |  |  |  |  |  | x = r[2][2]; | 
| 91 | 0 | 0 |  |  |  |  | *btheta = ( x != 0.0 || y != 0.0 ) ? - atan2(y,x) : 0.0; | 
| 92 |  |  |  |  |  |  |  | 
| 93 | 0 |  |  |  |  |  | y = -r[1][0]; | 
| 94 | 0 |  |  |  |  |  | x = r[1][1]; | 
| 95 | 0 | 0 |  |  |  |  | *bzeta = ( x != 0.0 || y != 0.0 ) ? - atan2(y,x) : 0.0; | 
| 96 |  |  |  |  |  |  |  | 
| 97 | 0 |  |  |  |  |  | } | 
| 98 |  |  |  |  |  |  | /*---------------------------------------------------------------------- | 
| 99 |  |  |  |  |  |  | ** | 
| 100 |  |  |  |  |  |  | ** | 
| 101 |  |  |  |  |  |  | **  Copyright (C) 2013-2020, NumFOCUS Foundation. | 
| 102 |  |  |  |  |  |  | **  All rights reserved. | 
| 103 |  |  |  |  |  |  | ** | 
| 104 |  |  |  |  |  |  | **  This library is derived, with permission, from the International | 
| 105 |  |  |  |  |  |  | **  Astronomical Union's "Standards of Fundamental Astronomy" library, | 
| 106 |  |  |  |  |  |  | **  available from http://www.iausofa.org. | 
| 107 |  |  |  |  |  |  | ** | 
| 108 |  |  |  |  |  |  | **  The ERFA version is intended to retain identical functionality to | 
| 109 |  |  |  |  |  |  | **  the SOFA library, but made distinct through different function and | 
| 110 |  |  |  |  |  |  | **  file names, as set out in the SOFA license conditions.  The SOFA | 
| 111 |  |  |  |  |  |  | **  original has a role as a reference standard for the IAU and IERS, | 
| 112 |  |  |  |  |  |  | **  and consequently redistribution is permitted only in its unaltered | 
| 113 |  |  |  |  |  |  | **  state.  The ERFA version is not subject to this restriction and | 
| 114 |  |  |  |  |  |  | **  therefore can be included in distributions which do not support the | 
| 115 |  |  |  |  |  |  | **  concept of "read only" software. | 
| 116 |  |  |  |  |  |  | ** | 
| 117 |  |  |  |  |  |  | **  Although the intent is to replicate the SOFA API (other than | 
| 118 |  |  |  |  |  |  | **  replacement of prefix names) and results (with the exception of | 
| 119 |  |  |  |  |  |  | **  bugs;  any that are discovered will be fixed), SOFA is not | 
| 120 |  |  |  |  |  |  | **  responsible for any errors found in this version of the library. | 
| 121 |  |  |  |  |  |  | ** | 
| 122 |  |  |  |  |  |  | **  If you wish to acknowledge the SOFA heritage, please acknowledge | 
| 123 |  |  |  |  |  |  | **  that you are using a library derived from SOFA, rather than SOFA | 
| 124 |  |  |  |  |  |  | **  itself. | 
| 125 |  |  |  |  |  |  | ** | 
| 126 |  |  |  |  |  |  | ** | 
| 127 |  |  |  |  |  |  | **  TERMS AND CONDITIONS | 
| 128 |  |  |  |  |  |  | ** | 
| 129 |  |  |  |  |  |  | **  Redistribution and use in source and binary forms, with or without | 
| 130 |  |  |  |  |  |  | **  modification, are permitted provided that the following conditions | 
| 131 |  |  |  |  |  |  | **  are met: | 
| 132 |  |  |  |  |  |  | ** | 
| 133 |  |  |  |  |  |  | **  1 Redistributions of source code must retain the above copyright | 
| 134 |  |  |  |  |  |  | **    notice, this list of conditions and the following disclaimer. | 
| 135 |  |  |  |  |  |  | ** | 
| 136 |  |  |  |  |  |  | **  2 Redistributions in binary form must reproduce the above copyright | 
| 137 |  |  |  |  |  |  | **    notice, this list of conditions and the following disclaimer in | 
| 138 |  |  |  |  |  |  | **    the documentation and/or other materials provided with the | 
| 139 |  |  |  |  |  |  | **    distribution. | 
| 140 |  |  |  |  |  |  | ** | 
| 141 |  |  |  |  |  |  | **  3 Neither the name of the Standards Of Fundamental Astronomy Board, | 
| 142 |  |  |  |  |  |  | **    the International Astronomical Union nor the names of its | 
| 143 |  |  |  |  |  |  | **    contributors may be used to endorse or promote products derived | 
| 144 |  |  |  |  |  |  | **    from this software without specific prior written permission. | 
| 145 |  |  |  |  |  |  | ** | 
| 146 |  |  |  |  |  |  | **  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 
| 147 |  |  |  |  |  |  | **  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 
| 148 |  |  |  |  |  |  | **  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 
| 149 |  |  |  |  |  |  | **  FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE | 
| 150 |  |  |  |  |  |  | **  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | 
| 151 |  |  |  |  |  |  | **  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
| 152 |  |  |  |  |  |  | **  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
| 153 |  |  |  |  |  |  | **  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
| 154 |  |  |  |  |  |  | **  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
| 155 |  |  |  |  |  |  | **  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 
| 156 |  |  |  |  |  |  | **  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
| 157 |  |  |  |  |  |  | **  POSSIBILITY OF SUCH DAMAGE. | 
| 158 |  |  |  |  |  |  | ** | 
| 159 |  |  |  |  |  |  | */ |