1 #include "erfa.h"
2 #include "erfam.h"
3 
eraPmat76(double date1,double date2,double rmatp[3][3])4 void eraPmat76(double date1, double date2, double rmatp[3][3])
5 /*
6 **  - - - - - - - - - -
7 **   e r a P m a t 7 6
8 **  - - - - - - - - - -
9 **
10 **  Precession matrix from J2000.0 to a specified date, IAU 1976 model.
11 **
12 **  Given:
13 **     date1,date2 double       ending date, TT (Note 1)
14 **
15 **  Returned:
16 **     rmatp       double[3][3] precession matrix, J2000.0 -> date1+date2
17 **
18 **  Notes:
19 **
20 **  1) The TT date date1+date2 is a Julian Date, apportioned in any
21 **     convenient way between the two arguments.  For example,
22 **     JD(TT)=2450123.7 could be expressed in any of these ways,
23 **     among others:
24 **
25 **            date1          date2
26 **
27 **         2450123.7           0.0       (JD method)
28 **         2451545.0       -1421.3       (J2000 method)
29 **         2400000.5       50123.2       (MJD method)
30 **         2450123.5           0.2       (date & time method)
31 **
32 **     The JD method is the most natural and convenient to use in
33 **     cases where the loss of several decimal digits of resolution
34 **     is acceptable.  The J2000 method is best matched to the way
35 **     the argument is handled internally and will deliver the
36 **     optimum resolution.  The MJD method and the date & time methods
37 **     are both good compromises between resolution and convenience.
38 **
39 **  2) The matrix operates in the sense V(date) = RMATP * V(J2000),
40 **     where the p-vector V(J2000) is with respect to the mean
41 **     equatorial triad of epoch J2000.0 and the p-vector V(date)
42 **     is with respect to the mean equatorial triad of the given
43 **     date.
44 **
45 **  3) Though the matrix method itself is rigorous, the precession
46 **     angles are expressed through canonical polynomials which are
47 **     valid only for a limited time span.  In addition, the IAU 1976
48 **     precession rate is known to be imperfect.  The absolute accuracy
49 **     of the present formulation is better than 0.1 arcsec from
50 **     1960AD to 2040AD, better than 1 arcsec from 1640AD to 2360AD,
51 **     and remains below 3 arcsec for the whole of the period
52 **     500BC to 3000AD.  The errors exceed 10 arcsec outside the
53 **     range 1200BC to 3900AD, exceed 100 arcsec outside 4200BC to
54 **     5600AD and exceed 1000 arcsec outside 6800BC to 8200AD.
55 **
56 **  Called:
57 **     eraPrec76    accumulated precession angles, IAU 1976
58 **     eraIr        initialize r-matrix to identity
59 **     eraRz        rotate around Z-axis
60 **     eraRy        rotate around Y-axis
61 **     eraCr        copy r-matrix
62 **
63 **  References:
64 **
65 **     Lieske, J.H., 1979, Astron.Astrophys. 73, 282.
66 **      equations (6) & (7), p283.
67 **
68 **     Kaplan,G.H., 1981. USNO circular no. 163, pA2.
69 **
70 **  This revision:  2021 May 11
71 **
72 **  Copyright (C) 2013-2021, NumFOCUS Foundation.
73 **  Derived, with permission, from the SOFA library.  See notes at end of file.
74 */
75 {
76    double zeta, z, theta, wmat[3][3];
77 
78 
79 /* Precession Euler angles, J2000.0 to specified date. */
80    eraPrec76(ERFA_DJ00, 0.0, date1, date2, &zeta, &z, &theta);
81 
82 /* Form the rotation matrix. */
83    eraIr(  wmat);
84    eraRz( -zeta, wmat);
85    eraRy(  theta, wmat);
86    eraRz( -z, wmat);
87    eraCr( wmat, rmatp);
88 
89 /* Finished. */
90 
91 }
92 /*----------------------------------------------------------------------
93 **
94 **
95 **  Copyright (C) 2013-2021, 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 */
154