FACT++
1.0
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
gd2gce.c
Go to the documentation of this file.
1
#include "
erfa.h
"
2
3
int
eraGd2gce
(
double
a,
double
f,
double
elong,
double
phi,
4
double
height
,
double
xyz[3] )
5
/*
6
** - - - - - - - - - -
7
** e r a G d 2 g c e
8
** - - - - - - - - - -
9
**
10
** Transform geodetic coordinates to geocentric for a reference
11
** ellipsoid of specified form.
12
**
13
** Given:
14
** a double equatorial radius (Notes 1,4)
15
** f double flattening (Notes 2,4)
16
** elong double longitude (radians, east +ve)
17
** phi double latitude (geodetic, radians, Note 4)
18
** height double height above ellipsoid (geodetic, Notes 3,4)
19
**
20
** Returned:
21
** xyz double[3] geocentric vector (Note 3)
22
**
23
** Returned (function value):
24
** int status: 0 = OK
25
** -1 = illegal case (Note 4)
26
** Notes:
27
**
28
** 1) The equatorial radius, a, can be in any units, but meters is
29
** the conventional choice.
30
**
31
** 2) The flattening, f, is (for the Earth) a value around 0.00335,
32
** i.e. around 1/298.
33
**
34
** 3) The equatorial radius, a, and the height, height, must be
35
** given in the same units, and determine the units of the
36
** returned geocentric vector, xyz.
37
**
38
** 4) No validation is performed on individual arguments. The error
39
** status -1 protects against (unrealistic) cases that would lead
40
** to arithmetic exceptions. If an error occurs, xyz is unchanged.
41
**
42
** 5) The inverse transformation is performed in the function
43
** eraGc2gde.
44
**
45
** 6) The transformation for a standard ellipsoid (such as ERFA_WGS84) can
46
** more conveniently be performed by calling eraGd2gc, which uses a
47
** numerical code to identify the required a and f values.
48
**
49
** References:
50
**
51
** Green, R.M., Spherical Astronomy, Cambridge University Press,
52
** (1985) Section 4.5, p96.
53
**
54
** Explanatory Supplement to the Astronomical Almanac,
55
** P. Kenneth Seidelmann (ed), University Science Books (1992),
56
** Section 4.22, p202.
57
**
58
** Copyright (C) 2013-2015, NumFOCUS Foundation.
59
** Derived, with permission, from the SOFA library. See notes at end of file.
60
*/
61
{
62
double
sp, cp, w, d, ac, as, r;
63
64
/* Functions of geodetic latitude. */
65
sp = sin(phi);
66
cp = cos(phi);
67
w = 1.0 - f;
68
w = w * w;
69
d = cp*cp + w*sp*sp;
70
if
( d <= 0.0 )
return
-1;
71
ac = a / sqrt(d);
72
as = w * ac;
73
74
/* Geocentric vector. */
75
r = (ac +
height
) * cp;
76
xyz[0] = r * cos(elong);
77
xyz[1] = r * sin(elong);
78
xyz[2] = (as +
height
) * sp;
79
80
/* Success. */
81
return
0;
82
83
}
84
/*----------------------------------------------------------------------
85
**
86
**
87
** Copyright (C) 2013-2015, NumFOCUS Foundation.
88
** All rights reserved.
89
**
90
** This library is derived, with permission, from the International
91
** Astronomical Union's "Standards of Fundamental Astronomy" library,
92
** available from http://www.iausofa.org.
93
**
94
** The ERFA version is intended to retain identical functionality to
95
** the SOFA library, but made distinct through different function and
96
** file names, as set out in the SOFA license conditions. The SOFA
97
** original has a role as a reference standard for the IAU and IERS,
98
** and consequently redistribution is permitted only in its unaltered
99
** state. The ERFA version is not subject to this restriction and
100
** therefore can be included in distributions which do not support the
101
** concept of "read only" software.
102
**
103
** Although the intent is to replicate the SOFA API (other than
104
** replacement of prefix names) and results (with the exception of
105
** bugs; any that are discovered will be fixed), SOFA is not
106
** responsible for any errors found in this version of the library.
107
**
108
** If you wish to acknowledge the SOFA heritage, please acknowledge
109
** that you are using a library derived from SOFA, rather than SOFA
110
** itself.
111
**
112
**
113
** TERMS AND CONDITIONS
114
**
115
** Redistribution and use in source and binary forms, with or without
116
** modification, are permitted provided that the following conditions
117
** are met:
118
**
119
** 1 Redistributions of source code must retain the above copyright
120
** notice, this list of conditions and the following disclaimer.
121
**
122
** 2 Redistributions in binary form must reproduce the above copyright
123
** notice, this list of conditions and the following disclaimer in
124
** the documentation and/or other materials provided with the
125
** distribution.
126
**
127
** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
128
** the International Astronomical Union nor the names of its
129
** contributors may be used to endorse or promote products derived
130
** from this software without specific prior written permission.
131
**
132
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
133
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
134
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
135
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
136
** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
137
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
138
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
139
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
140
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
141
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
142
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
143
** POSSIBILITY OF SUCH DAMAGE.
144
**
145
*/
eraGd2gce
int eraGd2gce(double a, double f, double elong, double phi, double height, double xyz[3])
Definition:
gd2gce.c:3
height
float height
Definition:
HeadersGPS.h:26
erfa.h
erfa
src
gd2gce.c
Generated on Sun Sep 18 2016 20:50:18 for FACT++ by
1.8.11