1 /*
2 * - - - - - - - - - - - - -
3 * g a l _ p q w 2 i j k m
4 * - - - - - - - - - - - - -
5 *
6 * This routine is part of the General Astrodynamics Library
7 *
8 * Description:
9 *
10 * This routine forms the PQW to IJK transformation matrix.
11 *
12 * Status:
13 *
14 * support routine.
15 *
16 * Given:
17 *
18 * raan d Longitude of the ascending mode (radians)
19 * argp d Argument of Pericentre (radians)
20 * inc d Inclination (radians)
21 *
22 * Returned:
23 *
24 * pqw2ijkm d[3][3] Transformation Matrix
25 *
26 * References:
27 *
28 * Satellite Orbits
29 * Oliver Montenbruck, Eberhard Gill
30 * Springer 2005
31 * Chapter 2
32 *
33 * This revision:
34 *
35 * 2008 July 19
36 *
37 * Copyright (C) 2008 Paul C. L. Willmott. See notes at end.
38 *
39 *-----------------------------------------------------------------------
40 */
41
42 #include "gal_pqw2ijkm.h"
43 #include <math.h>
44
45 void
gal_pqw2ijkm(double raan,double argp,double inc,double pqw2ijkm[3][3])46 gal_pqw2ijkm
47 (
48 double raan,
49 double argp,
50 double inc,
51 double pqw2ijkm[3][3]
52 )
53
54 {
55
56 double cargp, sargp, craan, sraan, cinc, sinc ;
57
58 /*
59 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
60 */
61
62 /*
63 * Calculate intermediates
64 */
65
66 cargp = cos ( argp ) ;
67 sargp = sin ( argp ) ;
68 craan = cos ( raan ) ;
69 sraan = sin ( raan ) ;
70 cinc = cos ( inc ) ;
71 sinc = sin ( inc ) ;
72
73 /* P */
74
75 pqw2ijkm[0][0] = +cargp * craan - sargp * cinc * sraan ;
76 pqw2ijkm[1][0] = +cargp * sraan + sargp * cinc * craan ;
77 pqw2ijkm[2][0] = +sargp * sinc ;
78
79 /* Q */
80
81 pqw2ijkm[0][1] = -sargp * craan - cargp * cinc * sraan ;
82 pqw2ijkm[1][1] = -sargp * sraan + cargp * cinc * craan ;
83 pqw2ijkm[2][1] = +cargp * sinc ;
84
85 /* W */
86
87 pqw2ijkm[0][2] = +sinc * sraan ;
88 pqw2ijkm[1][2] = -sinc * craan ;
89 pqw2ijkm[2][2] = +cinc ;
90
91 /*
92 * Finished.
93 */
94
95 }
96
97 /*
98 * gal - General Astrodynamics Library
99 * Copyright (C) 2008 Paul C. L. Willmott
100 *
101 * This program is free software; you can redistribute it and/or modify
102 * it under the terms of the GNU General Public License as published by
103 * the Free Software Foundation; either version 2 of the License, or
104 * (at your option) any later version.
105 *
106 * This program is distributed in the hope that it will be useful,
107 * but WITHOUT ANY WARRANTY; without even the implied warranty of
108 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
109 * GNU General Public License for more details.
110 *
111 * You should have received a copy of the GNU General Public License along
112 * with this program; if not, write to the Free Software Foundation, Inc.,
113 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
114 *
115 * Contact:
116 *
117 * Paul Willmott
118 * vp9mu@amsat.org
119 */
120
121