1 /*
2 * - - - - - -
3 * gal _ g a l _ r z
4 * - - - - - -
5 *
6 * This routine is part of the General Astrodynamics Library
7 *
8 * Description:
9 *
10 * Rotate an r-matrix about the z-axis.
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 * vector/matrix support routine.
18 *
19 * Given:
20 *
21 * psi d angle (radians)
22 *
23 * Given and returned:
24 * r d[3][3] r-matrix, rotated
25 *
26 * Notes:
27 *
28 * 1) Sign convention: The matrix can be used to rotate the
29 * reference frame of a vector. Calling this routine with
30 * positive psi incorporates in the matrix an additional
31 * rotation, about the z-axis, anticlockwise as seen looking
32 * towards the origin from positive z.
33 *
34 * Called:
35 *
36 * gal_ir initialize r-matrix to identity
37 * gal_rxr product of two r-matrices
38 * gal_cr copy r-matrix
39 *
40 * This revision:
41 *
42 * 2006 November 13 ( c version 2008 June 8 )
43 *
44 *
45 * Copyright (C) 2008 Paul C. L. Willmott. See notes at end.
46 *
47 *-----------------------------------------------------------------------
48 */
49
50 #include <math.h>
51 #include "gal_rz.h"
52 #include "gal_ir.h"
53 #include "gal_rxr.h"
54 #include "gal_cr.h"
55
56 void
gal_rz(double psi,double r[3][3])57 gal_rz
58 (
59 double psi,
60 double r[3][3]
61 )
62 {
63
64 double s, c, a[3][3], w[3][3] ;
65
66 /*
67 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
68 */
69
70 /*
71 * Matrix representing new rotation.
72 */
73
74 s = sin ( psi ) ;
75 c = cos ( psi ) ;
76 gal_ir ( a ) ;
77
78 a[0][0] = c ;
79 a[1][0] = -s ;
80 a[0][1] = s ;
81 a[1][1] = c ;
82
83 /*
84 * Rotate.
85 */
86
87 gal_rxr ( a, r, w ) ;
88
89 /*
90 * Return result.
91 */
92
93 gal_cr ( w, r ) ;
94
95 /*
96 * Finished.
97 */
98
99 }
100
101 /*
102 * gal - General Astrodynamics Library
103 * Copyright (C) 2008 Paul C. L. Willmott
104 *
105 * This program is free software; you can redistribute it and/or modify
106 * it under the terms of the GNU General Public License as published by
107 * the Free Software Foundation; either version 2 of the License, or
108 * (at your option) any later version.
109 *
110 * This program is distributed in the hope that it will be useful,
111 * but WITHOUT ANY WARRANTY; without even the implied warranty of
112 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
113 * GNU General Public License for more details.
114 *
115 * You should have received a copy of the GNU General Public License along
116 * with this program; if not, write to the Free Software Foundation, Inc.,
117 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
118 *
119 * Contact:
120 *
121 * Paul Willmott
122 * vp9mu@amsat.org
123 */
124