1 /*
2  *  - - - - - - - - - - - - - -
3  *   g a l _ e m d e t a i l s
4  *  - - - - - - - - - - - - - -
5  *
6  *  This routine is part of the General Astrodynamics Library
7  *
8  *  Description:
9  *
10  *     This routine returns the full details of the requested ellipsoid model.
11  *
12  *  Status:
13  *
14  *     Canonical model.
15  *
16  *  Given:
17  *
18  *     em               i           Ellipsoid Model Identifier (Note 1)
19  *
20  *  Returned:
21  *
22  *     *body            i           Solar System Body Identifier
23  *     *name          c[40]         Ellipsoid Model name
24  *     *sma             d           Semi-major axis ( m )
25  *     *inf             d           Inverse flattening factor
26  *     gal_emdetails    i           0 = success
27  *                                  1 = invalid Ellipsoid Model Identifier
28  *
29  *  Notes:
30  *
31  *  1) The header file gal_ellipsoids.h defines the following constants for the valid
32  *     values of em:
33  *
34  *     Identifier                 Ellisoid Model
35  *     ----------                 --------------
36  *
37  *	   GAL_EMEA_DEL1800	          Delambre 1800
38  *	   GAL_EMEA_AIRY1830          Airy 1830
39  *	   GAL_EMEA_EVER1830          Everest 1830
40  *	   GAL_EMEA_EVER1830BA        Everest 1830 Boni Alt
41  *	   GAL_EMEA_BESL1841          Bessel 1841
42  *	   GAL_EMEA_CL1866            Clarke 1866
43  *	   GAL_EMEA_CL1880	          Clarke 1880
44  *	   GAL_EMEA_CLA1880M          Clarke 1880 Modified
45  *	   GAL_EMEA_HEL1906	          Helmert 1906
46  *	   GAL_EMEA_INTL1909          International 1909
47  *	   GAL_EMEA_KRSV	          Krassovsky
48  *	   GAL_EMEA_MERC1960	      Mercury 1960
49  *	   GAL_EMEA_WGS1960	          World Geodetic System 1960
50  *	   GAL_EMEA_IAU1964	          IAU 1964
51  *	   GAL_EMEA_AUSNAT1965	      Australian National 1965
52  *	   GAL_EMEA_WGS1966	          World Geodetic System 1966
53  *	   GAL_EMEA_MERC1968M	      Modified Mercury 1968
54  *	   GAL_EMEA_SA1969		      South American 1969
55  *	   GAL_EMEA_GRS1967	          Geodetic Reference System 1967
56  *	   GAL_EMEA_WGS1972	          World Geodetic System 1972
57  *	   GAL_EMEA_IAG1975	          IAG 1975
58  *	   GAL_EMEA_IAU1976           IAU 1976
59  *	   GAL_EMEA_GRS1980	          Geodetic Reference System 1980
60  *	   GAL_EMEA_MERIT1983	      MERIT 1983
61  *	   GAL_EMEA_WGS1984	          World Geodetic System 1984
62  *	   GAL_EMEA_IERS1989          IERS 1989
63  *	   GAL_EMEA_IERS2000          IERS 2000
64  *     GAL_EMME_IAU1991           IAU/IAG/COSPAR 1991 Mercury
65  *     GAL_EMVE_IAU1991           IAU/IAG/COSPAR 1991 Venus
66  *     GAL_EMEA_IAU1991           IAU/IAG/COSPAR 1991 Earth
67  *     GAL_EMMA_IAU1991           IAU/IAG/COSPAR 1991 Mars
68  *     GAL_EMJU_IAU1991           IAU/IAG/COSPAR 1991 Jupiter
69  *     GAL_EMSA_IAU1991           IAU/IAG/COSPAR 1991 Saturn
70  *     GAL_EMUR_IAU1991           IAU/IAG/COSPAR 1991 Uranus
71  *     GAL_EMNE_IAU1991           IAU/IAG/COSPAR 1991 Neptune
72  *     GAL_EMPL_IAU1991           IAU/IAG/COSPAR 1991 Pluto
73  *     GAL_EMSU_IAU1991           IAU/IAG/COSPAR 1991 Sun
74  *
75  *  2) Where differences in values were found between references
76  *     Seidelmann was selected. IAU/IAG/COSPAR 1991 values are taken
77  *     from Davis et al. 1991
78  *
79  *  References:
80  *
81  *     Explanatory Supplement to the Astronomical Almanac
82  *     Edited by P. Kenneth Seidelmann, 1992
83  *     Page 220
84  *
85  *     Map Projection Transformations
86  *     by Qihe Yang, John P. Snyder and Waldo R. Tobler
87  *     Page 14
88  *
89  *     McCarthy, D.D., IERS Conventions 2000, Chapter 4 (2002).
90  *
91  *     Report of the IAU/IAG/COSPAR Working Group on
92  *     Cartographic Coordinates and Rotational Elements of
93  *     the Planets and Satellites: 1991
94  *     M. E. Davis et al.
95  *
96  *  This revision:
97  *
98  *     2009 January 6
99  *
100  *  Copyright (C) 2008, 2009 Paul C. L. Willmott. See notes at end.
101  *
102  *-----------------------------------------------------------------------
103  */
104 
105 #include <stdio.h>
106 #include <strings.h>
107 #include "gal_emdetails.h"
108 #include "gal_const.h"
109 
110 int
gal_emdetails(const int em,int * body,char * name,double * sma,double * inf)111 gal_emdetails
112   (
113     const int em,
114     int *body,
115     char *name,
116     double *sma,
117     double *inf
118   )
119 
120 {
121 
122 /*
123  * ----------------
124  * Ellipsoid Models
125  * ----------------
126  */
127 
128 #define EMMAX 37  /* Number of Ellipsoid Models defined */
129 
130   static const struct {
131 
132     int    body  ;  /* Solar System Body Identifier */
133     char   *name ;  /* Ellipsoid Model Name         */
134     double sma   ;  /* Semi-Major Axis              */
135     double inf   ;  /* Inverse Flattening           */
136 
137   } *emp, ELLIPSOIDS[EMMAX] = {
138 
139 
140     { GAL_SSB_EA, "Delambre 1800",                  6375653.0,   334.0          } ,
141     { GAL_SSB_EA, "Airy 1830",                      6377563.396, 299.324964     } ,
142     { GAL_SSB_EA, "Everest 1830",                   6377276.345, 300.8017       } ,
143     { GAL_SSB_EA, "Everest 1830 (Boni alternate)",  6377301.243, 300.8017       } ,
144     { GAL_SSB_EA, "Bessel 1841",                    6377397.155, 299.152813     } ,
145     { GAL_SSB_EA, "Clarke 1866",                    6378206.4,   294.978698     } ,
146     { GAL_SSB_EA, "Clarke 1880",                    6378249.145, 293.465        } ,
147     { GAL_SSB_EA, "Clarke 1880 (modified)",         6378249.145, 293.4663       } ,
148     { GAL_SSB_EA, "Helmert 1906",                   6378200.0,   298.3          } ,
149     { GAL_SSB_EA, "International 1909",             6378388.0,   297.0          } ,
150     { GAL_SSB_EA, "Krassovsky",                     6378245.0,   298.3          } ,
151     { GAL_SSB_EA, "Mercury 1960",                   6378166.0,   298.3          } ,
152     { GAL_SSB_EA, "WGS60",                          6378165.0,   298.3          } ,
153     { GAL_SSB_EA, "IAU 1964",                       6378160.0,   298.25         } ,
154     { GAL_SSB_EA, "Australian National 1965",       6378160.0,   298.25         } ,
155     { GAL_SSB_EA, "WGS66",                          6378145.0,   298.25         } ,
156     { GAL_SSB_EA, "Modified Mercury 1968",          6378150.0,   298.3          } ,
157     { GAL_SSB_EA, "South American 1969",            6378160.0,   298.25         } ,
158     { GAL_SSB_EA, "Geodetic Reference System 1967", 6378160.0,   298.2471674273 } ,
159     { GAL_SSB_EA, "WGS72",                          6378135.0,   298.26         } ,
160     { GAL_SSB_EA, "IAG 1975",                       6378140.0,   298.256        } ,
161     { GAL_SSB_EA, "IAU 1976",                       6378140.0,   298.257        } ,
162     { GAL_SSB_EA, "Geodetic Reference System 1980", 6378137.0,   298.257222101  } ,
163     { GAL_SSB_EA, "MERIT 1983",                     6378137.0,   298.257        } ,
164     { GAL_SSB_EA, "WGS84",                          6378137.0,   298.257223563  } ,
165     { GAL_SSB_EA, "IERS 1989",                      6378136.0,   298.257        } ,
166     { GAL_SSB_EA, "IERS 2000",                      6378136.6,   298.25642      } ,
167     { GAL_SSB_ME, "IAU/IAG/COSPAR 1991 Mercury",    2439700.0,     0.0          } ,
168     { GAL_SSB_VE, "IAU/IAG/COSPAR 1991 Venus",      6501900.0,     0.0          } ,
169     { GAL_SSB_EA, "IAU/IAG/COSPAR 1991 Earth",      6378140.0,   298.257        } ,
170     { GAL_SSB_MA, "IAU/IAG/COSPAR 1991 Mars",       3397000.0,   153.846        } ,
171     { GAL_SSB_JU, "IAU/IAG/COSPAR 1991 Jupiter",   71492000.0,    15.4154       } ,
172     { GAL_SSB_SA, "IAU/IAG/COSPAR 1991 Saturn",    60268000.0,    10.2082       } ,
173     { GAL_SSB_UR, "IAU/IAG/COSPAR 1991 Uranus",    25559000.0,    43.611        } ,
174     { GAL_SSB_NE, "IAU/IAG/COSPAR 1991 Neptune",   24764000.0,    58.4795       } ,
175     { GAL_SSB_PL, "IAU/IAG/COSPAR 1991 Pluto",      1151000.0,     0.0          } ,
176     { GAL_SSB_SU, "IAU/IAG/COSPAR 1991 Sun",           6.96e8,     0.0          } ,
177 
178   } ;
179 
180 /*
181  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
182  */
183 
184   if ( em < 0 || em >= EMMAX ) {
185     *body = -1   ;
186     name[0]  = '\0' ;
187     *sma  = 0.0  ;
188     *inf  = 0.0  ;
189     return 1 ;
190   }
191   else {
192     emp = &ELLIPSOIDS[em] ;
193     *body = emp->body ;
194     strcpy ( name, emp->name ) ;
195     *sma  = emp->sma  ;
196     *inf  = emp->inf  ;
197     return 0 ;
198   }
199 
200 /*
201  * Finished.
202  */
203 
204 }
205 
206 /*
207  *  gal - General Astrodynamics Library
208  *  Copyright (C) 2008, 2009 Paul C. L. Willmott
209  *
210  *  This program is free software; you can redistribute it and/or modify
211  *  it under the terms of the GNU General Public License as published by
212  *  the Free Software Foundation; either version 2 of the License, or
213  *  (at your option) any later version.
214  *
215  *  This program is distributed in the hope that it will be useful,
216  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
217  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
218  *  GNU General Public License for more details.
219  *
220  *  You should have received a copy of the GNU General Public License along
221  *  with this program; if not, write to the Free Software Foundation, Inc.,
222  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
223  *
224  *  Contact:
225  *
226  *  Paul Willmott
227  *  vp9mu@amsat.org
228  */
229 
230 
231 
232