source: trunk/FACT++/sofa/src/gd2gc.c@ 18375

Last change on this file since 18375 was 18346, checked in by tbretz, 11 years ago
File size: 6.6 KB
Line 
1#include "sofa.h"
2
3int iauGd2gc ( int n, double elong, double phi, double height,
4 double xyz[3] )
5/*
6** - - - - - - - - -
7** i a u G d 2 g c
8** - - - - - - - - -
9**
10** Transform geodetic coordinates to geocentric using the specified
11** reference ellipsoid.
12**
13** This function is part of the International Astronomical Union's
14** SOFA (Standards of Fundamental Astronomy) software collection.
15**
16** Status: canonical transformation.
17**
18** Given:
19** n int ellipsoid identifier (Note 1)
20** elong double longitude (radians, east +ve)
21** phi double latitude (geodetic, radians, Note 3)
22** height double height above ellipsoid (geodetic, Notes 2,3)
23**
24** Returned:
25** xyz double[3] geocentric vector (Note 2)
26**
27** Returned (function value):
28** int status: 0 = OK
29** -1 = illegal identifier (Note 3)
30** -2 = illegal case (Note 3)
31**
32** Notes:
33**
34** 1) The identifier n is a number that specifies the choice of
35** reference ellipsoid. The following are supported:
36**
37** n ellipsoid
38**
39** 1 WGS84
40** 2 GRS80
41** 3 WGS72
42**
43** The n value has no significance outside the SOFA software. For
44** convenience, symbols WGS84 etc. are defined in sofam.h.
45**
46** 2) The height (height, given) and the geocentric vector (xyz,
47** returned) are in meters.
48**
49** 3) No validation is performed on the arguments elong, phi and
50** height. An error status -1 means that the identifier n is
51** illegal. An error status -2 protects against cases that would
52** lead to arithmetic exceptions. In all error cases, xyz is set
53** to zeros.
54**
55** 4) The inverse transformation is performed in the function iauGc2gd.
56**
57** Called:
58** iauEform Earth reference ellipsoids
59** iauGd2gce geodetic to geocentric transformation, general
60** iauZp zero p-vector
61**
62** This revision: 2013 June 18
63**
64** SOFA release 2015-02-09
65**
66** Copyright (C) 2015 IAU SOFA Board. See notes at end.
67*/
68{
69 int j;
70 double a, f;
71
72/* Obtain reference ellipsoid parameters. */
73 j = iauEform ( n, &a, &f );
74
75/* If OK, transform longitude, geodetic latitude, height to x,y,z. */
76 if ( j == 0 ) {
77 j = iauGd2gce ( a, f, elong, phi, height, xyz );
78 if ( j != 0 ) j = -2;
79 }
80
81/* Deal with any errors. */
82 if ( j != 0 ) iauZp ( xyz );
83
84/* Return the status. */
85 return j;
86
87/*----------------------------------------------------------------------
88**
89** Copyright (C) 2015
90** Standards Of Fundamental Astronomy Board
91** of the International Astronomical Union.
92**
93** =====================
94** SOFA Software License
95** =====================
96**
97** NOTICE TO USER:
98**
99** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
100** CONDITIONS WHICH APPLY TO ITS USE.
101**
102** 1. The Software is owned by the IAU SOFA Board ("SOFA").
103**
104** 2. Permission is granted to anyone to use the SOFA software for any
105** purpose, including commercial applications, free of charge and
106** without payment of royalties, subject to the conditions and
107** restrictions listed below.
108**
109** 3. You (the user) may copy and distribute SOFA source code to others,
110** and use and adapt its code and algorithms in your own software,
111** on a world-wide, royalty-free basis. That portion of your
112** distribution that does not consist of intact and unchanged copies
113** of SOFA source code files is a "derived work" that must comply
114** with the following requirements:
115**
116** a) Your work shall be marked or carry a statement that it
117** (i) uses routines and computations derived by you from
118** software provided by SOFA under license to you; and
119** (ii) does not itself constitute software provided by and/or
120** endorsed by SOFA.
121**
122** b) The source code of your derived work must contain descriptions
123** of how the derived work is based upon, contains and/or differs
124** from the original SOFA software.
125**
126** c) The names of all routines in your derived work shall not
127** include the prefix "iau" or "sofa" or trivial modifications
128** thereof such as changes of case.
129**
130** d) The origin of the SOFA components of your derived work must
131** not be misrepresented; you must not claim that you wrote the
132** original software, nor file a patent application for SOFA
133** software or algorithms embedded in the SOFA software.
134**
135** e) These requirements must be reproduced intact in any source
136** distribution and shall apply to anyone to whom you have
137** granted a further right to modify the source code of your
138** derived work.
139**
140** Note that, as originally distributed, the SOFA software is
141** intended to be a definitive implementation of the IAU standards,
142** and consequently third-party modifications are discouraged. All
143** variations, no matter how minor, must be explicitly marked as
144** such, as explained above.
145**
146** 4. You shall not cause the SOFA software to be brought into
147** disrepute, either by misuse, or use for inappropriate tasks, or
148** by inappropriate modification.
149**
150** 5. The SOFA software is provided "as is" and SOFA makes no warranty
151** as to its use or performance. SOFA does not and cannot warrant
152** the performance or results which the user may obtain by using the
153** SOFA software. SOFA makes no warranties, express or implied, as
154** to non-infringement of third party rights, merchantability, or
155** fitness for any particular purpose. In no event will SOFA be
156** liable to the user for any consequential, incidental, or special
157** damages, including any lost profits or lost savings, even if a
158** SOFA representative has been advised of such damages, or for any
159** claim by any third party.
160**
161** 6. The provision of any version of the SOFA software under the terms
162** and conditions specified herein does not imply that future
163** versions will also be made available under the same terms and
164** conditions.
165*
166** In any published work or commercial product which uses the SOFA
167** software directly, acknowledgement (see www.iausofa.org) is
168** appreciated.
169**
170** Correspondence concerning SOFA software should be addressed as
171** follows:
172**
173** By email: sofa@ukho.gov.uk
174** By post: IAU SOFA Center
175** HM Nautical Almanac Office
176** UK Hydrographic Office
177** Admiralty Way, Taunton
178** Somerset, TA1 2DN
179** United Kingdom
180**
181**--------------------------------------------------------------------*/
182
183}
Note: See TracBrowser for help on using the repository browser.