source: trunk/FACT++/sofa/src/eform.c@ 18368

Last change on this file since 18368 was 18346, checked in by tbretz, 11 years ago
File size: 6.5 KB
Line 
1#include "sofa.h"
2
3int iauEform ( int n, double *a, double *f )
4/*
5** - - - - - - - - -
6** i a u E f o r m
7** - - - - - - - - -
8**
9** Earth reference ellipsoids.
10**
11** This function is part of the International Astronomical Union's
12** SOFA (Standards of Fundamental Astronomy) software collection.
13**
14** Status: canonical.
15**
16** Given:
17** n int ellipsoid identifier (Note 1)
18**
19** Returned:
20** a double equatorial radius (meters, Note 2)
21** f double flattening (Note 2)
22**
23** Returned (function value):
24** int status: 0 = OK
25** -1 = illegal identifier (Note 3)
26**
27** Notes:
28**
29** 1) The identifier n is a number that specifies the choice of
30** reference ellipsoid. The following are supported:
31**
32** n ellipsoid
33**
34** 1 WGS84
35** 2 GRS80
36** 3 WGS72
37**
38** The n value has no significance outside the SOFA software. For
39** convenience, symbols WGS84 etc. are defined in sofam.h.
40**
41** 2) The ellipsoid parameters are returned in the form of equatorial
42** radius in meters (a) and flattening (f). The latter is a number
43** around 0.00335, i.e. around 1/298.
44**
45** 3) For the case where an unsupported n value is supplied, zero a and
46** f are returned, as well as error status.
47**
48** References:
49**
50** Department of Defense World Geodetic System 1984, National
51** Imagery and Mapping Agency Technical Report 8350.2, Third
52** Edition, p3-2.
53**
54** Moritz, H., Bull. Geodesique 66-2, 187 (1992).
55**
56** The Department of Defense World Geodetic System 1972, World
57** Geodetic System Committee, May 1974.
58**
59** Explanatory Supplement to the Astronomical Almanac,
60** P. Kenneth Seidelmann (ed), University Science Books (1992),
61** p220.
62**
63** This revision: 2013 June 18
64**
65** SOFA release 2015-02-09
66**
67** Copyright (C) 2015 IAU SOFA Board. See notes at end.
68*/
69{
70
71/* Look up a and f for the specified reference ellipsoid. */
72 switch ( n ) {
73
74 case WGS84:
75 *a = 6378137.0;
76 *f = 1.0 / 298.257223563;
77 break;
78
79 case GRS80:
80 *a = 6378137.0;
81 *f = 1.0 / 298.257222101;
82 break;
83
84 case WGS72:
85 *a = 6378135.0;
86 *f = 1.0 / 298.26;
87 break;
88
89 default:
90
91 /* Invalid identifier. */
92 *a = 0.0;
93 *f = 0.0;
94 return -1;
95
96 }
97
98/* OK status. */
99 return 0;
100
101/*----------------------------------------------------------------------
102**
103** Copyright (C) 2015
104** Standards Of Fundamental Astronomy Board
105** of the International Astronomical Union.
106**
107** =====================
108** SOFA Software License
109** =====================
110**
111** NOTICE TO USER:
112**
113** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
114** CONDITIONS WHICH APPLY TO ITS USE.
115**
116** 1. The Software is owned by the IAU SOFA Board ("SOFA").
117**
118** 2. Permission is granted to anyone to use the SOFA software for any
119** purpose, including commercial applications, free of charge and
120** without payment of royalties, subject to the conditions and
121** restrictions listed below.
122**
123** 3. You (the user) may copy and distribute SOFA source code to others,
124** and use and adapt its code and algorithms in your own software,
125** on a world-wide, royalty-free basis. That portion of your
126** distribution that does not consist of intact and unchanged copies
127** of SOFA source code files is a "derived work" that must comply
128** with the following requirements:
129**
130** a) Your work shall be marked or carry a statement that it
131** (i) uses routines and computations derived by you from
132** software provided by SOFA under license to you; and
133** (ii) does not itself constitute software provided by and/or
134** endorsed by SOFA.
135**
136** b) The source code of your derived work must contain descriptions
137** of how the derived work is based upon, contains and/or differs
138** from the original SOFA software.
139**
140** c) The names of all routines in your derived work shall not
141** include the prefix "iau" or "sofa" or trivial modifications
142** thereof such as changes of case.
143**
144** d) The origin of the SOFA components of your derived work must
145** not be misrepresented; you must not claim that you wrote the
146** original software, nor file a patent application for SOFA
147** software or algorithms embedded in the SOFA software.
148**
149** e) These requirements must be reproduced intact in any source
150** distribution and shall apply to anyone to whom you have
151** granted a further right to modify the source code of your
152** derived work.
153**
154** Note that, as originally distributed, the SOFA software is
155** intended to be a definitive implementation of the IAU standards,
156** and consequently third-party modifications are discouraged. All
157** variations, no matter how minor, must be explicitly marked as
158** such, as explained above.
159**
160** 4. You shall not cause the SOFA software to be brought into
161** disrepute, either by misuse, or use for inappropriate tasks, or
162** by inappropriate modification.
163**
164** 5. The SOFA software is provided "as is" and SOFA makes no warranty
165** as to its use or performance. SOFA does not and cannot warrant
166** the performance or results which the user may obtain by using the
167** SOFA software. SOFA makes no warranties, express or implied, as
168** to non-infringement of third party rights, merchantability, or
169** fitness for any particular purpose. In no event will SOFA be
170** liable to the user for any consequential, incidental, or special
171** damages, including any lost profits or lost savings, even if a
172** SOFA representative has been advised of such damages, or for any
173** claim by any third party.
174**
175** 6. The provision of any version of the SOFA software under the terms
176** and conditions specified herein does not imply that future
177** versions will also be made available under the same terms and
178** conditions.
179*
180** In any published work or commercial product which uses the SOFA
181** software directly, acknowledgement (see www.iausofa.org) is
182** appreciated.
183**
184** Correspondence concerning SOFA software should be addressed as
185** follows:
186**
187** By email: sofa@ukho.gov.uk
188** By post: IAU SOFA Center
189** HM Nautical Almanac Office
190** UK Hydrographic Office
191** Admiralty Way, Taunton
192** Somerset, TA1 2DN
193** United Kingdom
194**
195**--------------------------------------------------------------------*/
196
197}
Note: See TracBrowser for help on using the repository browser.