1 /*
2  *  - - - - - - - - -
3  *   g a l _ f w 2 m
4  *  - - - - - - - - -
5  *
6  *  This routine is part of the General Astrodynamics Library
7  *
8  *  Description:
9  *
10  *  Form rotation matrix given the Fukushima-Williams angles.
11  *
12  *  This routine is an independent translation of a FORTRAN routine
13  *  that is part of IAU's SOFA software collection.
14  *
15  *  Status:
16  *
17  *     support routine.
18  *
19  *  Given:
20  *
21  *     gamb                d        F-W angle gamma_bar (radians)
22  *     phib                d        F-W angle phi_bar (radians)
23  *     psi                 d        F-W angle psi (radians)
24  *     eps                 d        F-W angle epsilon (radians)
25  *
26  *  Returned:
27  *
28  *     r                d[3][3]     rotation matrix
29  *
30  *  Notes:
31  *
32  *  1) Naming the following points:
33  *
34  *           e = J2000 ecliptic pole,
35  *           p = GCRS pole,
36  *           E = ecliptic pole of date,
37  *     and   P = CIP,
38  *
39  *     the four Fukushima-Williams angles are as follows:
40  *
41  *        gamb = gamma = epE
42  *        phib = phi = pE
43  *        psi = psi = pEP
44  *        eps = epsilon = EP
45  *
46  *  2) The matrix representing the combined effects of frame bias,
47  *     precession and nutation is:
48  *
49  *        NxPxB = R_1(-eps).R_3(-psi).R_1(phib).R_3(gamb)
50  *
51  *  3) Three different matrices can be constructed, depending on the
52  *     supplied angles:
53  *
54  *     o  To obtain the nutation x precession x frame bias matrix,
55  *        generate the four precession angles, generate the nutation
56  *        components and add them to the psi_bar and epsilon_A angles,
57  *        and call the present routine.
58  *
59  *     o  To obtain the precession x frame bias matrix, generate the
60  *        four precession angles and call the present routine.
61  *
62  *     o  To obtain the frame bias matrix, generate the four precession
63  *        angles for date J2000.0 and call the present routine.
64  *
65  *     The nutation-only and precession-only matrices can if necessary
66  *     be obtained by combining these three appropriately.
67  *
68  *  Called:
69  *
70  *     gal_ir             initialize r-matrix to identity
71  *     gal_rz             rotate around Z-axis
72  *     gal_rx             rotate around X-axis
73  *
74  *  References:
75  *
76  *     Hilton, J. et al., 2006, Celest.Mech.Dyn.Astron. 94, 351
77  *
78  *  This revision:
79  *
80  *      25 October 2006 ( c version 2008 January 19 )
81  *
82  *
83  *  Copyright (C) 2008 Paul C. L. Willmott. See notes at end.
84  *
85  *-----------------------------------------------------------------------
86  */
87 
88 #include "gal_fw2m.h"
89 #include "gal_ir.h"
90 #include "gal_rz.h"
91 #include "gal_rx.h"
92 
93 void
gal_fw2m(double gamb,double phib,double psi,double eps,double r[3][3])94 gal_fw2m
95  (
96     double gamb,
97     double phib,
98     double psi,
99     double eps,
100     double r[3][3]
101  )
102 {
103 
104 /*
105  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
106  */
107 
108 /*
109  * Construct the matrix.
110  */
111 
112     gal_ir ( r ) ;
113     gal_rz ( gamb, r ) ;
114     gal_rx ( phib, r ) ;
115     gal_rz ( -psi, r ) ;
116     gal_rx ( -eps, r ) ;
117 
118 /*
119  * Finished.
120  */
121 
122 }
123 
124 /*
125  *  gal - General Astrodynamics Library
126  *  Copyright (C) 2008 Paul C. L. Willmott
127  *
128  *  This program is free software; you can redistribute it and/or modify
129  *  it under the terms of the GNU General Public License as published by
130  *  the Free Software Foundation; either version 2 of the License, or
131  *  (at your option) any later version.
132  *
133  *  This program is distributed in the hope that it will be useful,
134  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
135  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
136  *  GNU General Public License for more details.
137  *
138  *  You should have received a copy of the GNU General Public License along
139  *  with this program; if not, write to the Free Software Foundation, Inc.,
140  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
141  *
142  *  Contact:
143  *
144  *  Paul Willmott
145  *  vp9mu@amsat.org
146  */
147