source: trunk/FACT++/erfa/src/pb06.c@ 18403

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