source: branches/FACT++_part_filenames/erfa/src/eform.c@ 18796

Last change on this file since 18796 was 18711, checked in by tbretz, 8 years ago
Updated to ERFA 1.3.0 (no relevant code change except the leap second at the beginning of 2017)
File size: 5.1 KB
Line 
1#include "erfa.h"
2
3int eraEform ( int n, double *a, double *f )
4/*
5** - - - - - - - - -
6** e r a E f o r m
7** - - - - - - - - -
8**
9** Earth reference ellipsoids.
10**
11** Given:
12** n int ellipsoid identifier (Note 1)
13**
14** Returned:
15** a double equatorial radius (meters, Note 2)
16** f double flattening (Note 2)
17**
18** Returned (function value):
19** int status: 0 = OK
20** -1 = illegal identifier (Note 3)
21**
22** Notes:
23**
24** 1) The identifier n is a number that specifies the choice of
25** reference ellipsoid. The following are supported:
26**
27** n ellipsoid
28**
29** 1 ERFA_WGS84
30** 2 ERFA_GRS80
31** 3 ERFA_WGS72
32**
33** The n value has no significance outside the ERFA software. For
34** convenience, symbols ERFA_WGS84 etc. are defined in erfam.h.
35**
36** 2) The ellipsoid parameters are returned in the form of equatorial
37** radius in meters (a) and flattening (f). The latter is a number
38** around 0.00335, i.e. around 1/298.
39**
40** 3) For the case where an unsupported n value is supplied, zero a and
41** f are returned, as well as error status.
42**
43** References:
44**
45** Department of Defense World Geodetic System 1984, National
46** Imagery and Mapping Agency Technical Report 8350.2, Third
47** Edition, p3-2.
48**
49** Moritz, H., Bull. Geodesique 66-2, 187 (1992).
50**
51** The Department of Defense World Geodetic System 1972, World
52** Geodetic System Committee, May 1974.
53**
54** Explanatory Supplement to the Astronomical Almanac,
55** P. Kenneth Seidelmann (ed), University Science Books (1992),
56** p220.
57**
58** Copyright (C) 2013-2016, NumFOCUS Foundation.
59** Derived, with permission, from the SOFA library. See notes at end of file.
60*/
61{
62
63/* Look up a and f for the specified reference ellipsoid. */
64 switch ( n ) {
65
66 case ERFA_WGS84:
67 *a = 6378137.0;
68 *f = 1.0 / 298.257223563;
69 break;
70
71 case ERFA_GRS80:
72 *a = 6378137.0;
73 *f = 1.0 / 298.257222101;
74 break;
75
76 case ERFA_WGS72:
77 *a = 6378135.0;
78 *f = 1.0 / 298.26;
79 break;
80
81 default:
82
83 /* Invalid identifier. */
84 *a = 0.0;
85 *f = 0.0;
86 return -1;
87
88 }
89
90/* OK status. */
91 return 0;
92
93}
94/*----------------------------------------------------------------------
95**
96**
97** Copyright (C) 2013-2016, NumFOCUS Foundation.
98** All rights reserved.
99**
100** This library is derived, with permission, from the International
101** Astronomical Union's "Standards of Fundamental Astronomy" library,
102** available from http://www.iausofa.org.
103**
104** The ERFA version is intended to retain identical functionality to
105** the SOFA library, but made distinct through different function and
106** file names, as set out in the SOFA license conditions. The SOFA
107** original has a role as a reference standard for the IAU and IERS,
108** and consequently redistribution is permitted only in its unaltered
109** state. The ERFA version is not subject to this restriction and
110** therefore can be included in distributions which do not support the
111** concept of "read only" software.
112**
113** Although the intent is to replicate the SOFA API (other than
114** replacement of prefix names) and results (with the exception of
115** bugs; any that are discovered will be fixed), SOFA is not
116** responsible for any errors found in this version of the library.
117**
118** If you wish to acknowledge the SOFA heritage, please acknowledge
119** that you are using a library derived from SOFA, rather than SOFA
120** itself.
121**
122**
123** TERMS AND CONDITIONS
124**
125** Redistribution and use in source and binary forms, with or without
126** modification, are permitted provided that the following conditions
127** are met:
128**
129** 1 Redistributions of source code must retain the above copyright
130** notice, this list of conditions and the following disclaimer.
131**
132** 2 Redistributions in binary form must reproduce the above copyright
133** notice, this list of conditions and the following disclaimer in
134** the documentation and/or other materials provided with the
135** distribution.
136**
137** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
138** the International Astronomical Union nor the names of its
139** contributors may be used to endorse or promote products derived
140** from this software without specific prior written permission.
141**
142** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
143** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
144** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
145** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
146** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
147** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
148** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
149** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
150** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
151** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
152** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
153** POSSIBILITY OF SUCH DAMAGE.
154**
155*/
Note: See TracBrowser for help on using the repository browser.