geographiclib 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/AUTHORS +12 -0
- data/LICENSE +24 -0
- data/ext/geographiclib/Accumulator.cpp +23 -0
- data/ext/geographiclib/AlbersEqualArea.cpp +445 -0
- data/ext/geographiclib/AzimuthalEquidistant.cpp +41 -0
- data/ext/geographiclib/CassiniSoldner.cpp +89 -0
- data/ext/geographiclib/CircularEngine.cpp +96 -0
- data/ext/geographiclib/DMS.cpp +381 -0
- data/ext/geographiclib/Ellipsoid.cpp +125 -0
- data/ext/geographiclib/EllipticFunction.cpp +512 -0
- data/ext/geographiclib/GARS.cpp +122 -0
- data/ext/geographiclib/GeoCoords.cpp +175 -0
- data/ext/geographiclib/Geocentric.cpp +172 -0
- data/ext/geographiclib/Geodesic.cpp +1908 -0
- data/ext/geographiclib/GeodesicExact.cpp +927 -0
- data/ext/geographiclib/GeodesicExactC4.cpp +7879 -0
- data/ext/geographiclib/GeodesicLine.cpp +321 -0
- data/ext/geographiclib/GeodesicLineExact.cpp +289 -0
- data/ext/geographiclib/GeographicLib/Accumulator.hpp +184 -0
- data/ext/geographiclib/GeographicLib/AlbersEqualArea.hpp +312 -0
- data/ext/geographiclib/GeographicLib/AzimuthalEquidistant.hpp +139 -0
- data/ext/geographiclib/GeographicLib/CassiniSoldner.hpp +204 -0
- data/ext/geographiclib/GeographicLib/CircularEngine.hpp +195 -0
- data/ext/geographiclib/GeographicLib/Config.h +12 -0
- data/ext/geographiclib/GeographicLib/Constants.hpp +387 -0
- data/ext/geographiclib/GeographicLib/DMS.hpp +370 -0
- data/ext/geographiclib/GeographicLib/Ellipsoid.hpp +534 -0
- data/ext/geographiclib/GeographicLib/EllipticFunction.hpp +692 -0
- data/ext/geographiclib/GeographicLib/GARS.hpp +143 -0
- data/ext/geographiclib/GeographicLib/GeoCoords.hpp +544 -0
- data/ext/geographiclib/GeographicLib/Geocentric.hpp +267 -0
- data/ext/geographiclib/GeographicLib/Geodesic.hpp +970 -0
- data/ext/geographiclib/GeographicLib/GeodesicExact.hpp +862 -0
- data/ext/geographiclib/GeographicLib/GeodesicLine.hpp +701 -0
- data/ext/geographiclib/GeographicLib/GeodesicLineExact.hpp +667 -0
- data/ext/geographiclib/GeographicLib/Geohash.hpp +180 -0
- data/ext/geographiclib/GeographicLib/Geoid.hpp +472 -0
- data/ext/geographiclib/GeographicLib/Georef.hpp +160 -0
- data/ext/geographiclib/GeographicLib/Gnomonic.hpp +206 -0
- data/ext/geographiclib/GeographicLib/GravityCircle.hpp +301 -0
- data/ext/geographiclib/GeographicLib/GravityModel.hpp +520 -0
- data/ext/geographiclib/GeographicLib/LambertConformalConic.hpp +313 -0
- data/ext/geographiclib/GeographicLib/LocalCartesian.hpp +236 -0
- data/ext/geographiclib/GeographicLib/MGRS.hpp +355 -0
- data/ext/geographiclib/GeographicLib/MagneticCircle.hpp +178 -0
- data/ext/geographiclib/GeographicLib/MagneticModel.hpp +347 -0
- data/ext/geographiclib/GeographicLib/Math.hpp +920 -0
- data/ext/geographiclib/GeographicLib/NormalGravity.hpp +350 -0
- data/ext/geographiclib/GeographicLib/OSGB.hpp +249 -0
- data/ext/geographiclib/GeographicLib/PolarStereographic.hpp +150 -0
- data/ext/geographiclib/GeographicLib/PolygonArea.hpp +288 -0
- data/ext/geographiclib/GeographicLib/Rhumb.hpp +589 -0
- data/ext/geographiclib/GeographicLib/SphericalEngine.hpp +376 -0
- data/ext/geographiclib/GeographicLib/SphericalHarmonic.hpp +354 -0
- data/ext/geographiclib/GeographicLib/SphericalHarmonic1.hpp +281 -0
- data/ext/geographiclib/GeographicLib/SphericalHarmonic2.hpp +315 -0
- data/ext/geographiclib/GeographicLib/TransverseMercator.hpp +196 -0
- data/ext/geographiclib/GeographicLib/TransverseMercatorExact.hpp +254 -0
- data/ext/geographiclib/GeographicLib/UTMUPS.hpp +421 -0
- data/ext/geographiclib/GeographicLib/Utility.hpp +612 -0
- data/ext/geographiclib/Geohash.cpp +102 -0
- data/ext/geographiclib/Geoid.cpp +509 -0
- data/ext/geographiclib/Georef.cpp +135 -0
- data/ext/geographiclib/Gnomonic.cpp +85 -0
- data/ext/geographiclib/GravityCircle.cpp +129 -0
- data/ext/geographiclib/GravityModel.cpp +360 -0
- data/ext/geographiclib/LambertConformalConic.cpp +456 -0
- data/ext/geographiclib/LocalCartesian.cpp +62 -0
- data/ext/geographiclib/MGRS.cpp +461 -0
- data/ext/geographiclib/MagneticCircle.cpp +52 -0
- data/ext/geographiclib/MagneticModel.cpp +269 -0
- data/ext/geographiclib/Math.cpp +63 -0
- data/ext/geographiclib/NormalGravity.cpp +262 -0
- data/ext/geographiclib/OSGB.cpp +167 -0
- data/ext/geographiclib/PolarStereographic.cpp +108 -0
- data/ext/geographiclib/PolygonArea.cpp +204 -0
- data/ext/geographiclib/Rhumb.cpp +383 -0
- data/ext/geographiclib/SphericalEngine.cpp +477 -0
- data/ext/geographiclib/TransverseMercator.cpp +603 -0
- data/ext/geographiclib/TransverseMercatorExact.cpp +464 -0
- data/ext/geographiclib/UTMUPS.cpp +296 -0
- data/ext/geographiclib/Utility.cpp +61 -0
- data/ext/geographiclib/extconf.rb +3 -0
- data/ext/geographiclib/geographiclib.cpp +62 -0
- data/lib/geographiclib.rb +20 -0
- metadata +140 -0
|
@@ -0,0 +1,534 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* \file Ellipsoid.hpp
|
|
3
|
+
* \brief Header for GeographicLib::Ellipsoid class
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Charles Karney (2012-2015) <charles@karney.com> and licensed
|
|
6
|
+
* under the MIT/X11 License. For more information, see
|
|
7
|
+
* http://geographiclib.sourceforge.net/
|
|
8
|
+
**********************************************************************/
|
|
9
|
+
|
|
10
|
+
#if !defined(GEOGRAPHICLIB_ELLIPSOID_HPP)
|
|
11
|
+
#define GEOGRAPHICLIB_ELLIPSOID_HPP 1
|
|
12
|
+
|
|
13
|
+
#include <GeographicLib/Constants.hpp>
|
|
14
|
+
#include <GeographicLib/TransverseMercator.hpp>
|
|
15
|
+
#include <GeographicLib/EllipticFunction.hpp>
|
|
16
|
+
#include <GeographicLib/AlbersEqualArea.hpp>
|
|
17
|
+
|
|
18
|
+
namespace GeographicLib {
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* \brief Properties of an ellipsoid
|
|
22
|
+
*
|
|
23
|
+
* This class returns various properties of the ellipsoid and converts
|
|
24
|
+
* between various types of latitudes. The latitude conversions are also
|
|
25
|
+
* possible using the various projections supported by %GeographicLib; but
|
|
26
|
+
* Ellipsoid provides more direct access (sometimes using private functions
|
|
27
|
+
* of the projection classes). Ellipsoid::RectifyingLatitude,
|
|
28
|
+
* Ellipsoid::InverseRectifyingLatitude, and Ellipsoid::MeridianDistance
|
|
29
|
+
* provide functionality which can be provided by the Geodesic class.
|
|
30
|
+
* However Geodesic uses a series approximation (valid for abs \e f < 1/150),
|
|
31
|
+
* whereas Ellipsoid computes these quantities using EllipticFunction which
|
|
32
|
+
* provides accurate results even when \e f is large. Use of this class
|
|
33
|
+
* should be limited to −3 < \e f < 3/4 (i.e., 1/4 < b/a < 4).
|
|
34
|
+
*
|
|
35
|
+
* Example of use:
|
|
36
|
+
* \include example-Ellipsoid.cpp
|
|
37
|
+
**********************************************************************/
|
|
38
|
+
|
|
39
|
+
class GEOGRAPHICLIB_EXPORT Ellipsoid {
|
|
40
|
+
private:
|
|
41
|
+
typedef Math::real real;
|
|
42
|
+
static const int numit_ = 10;
|
|
43
|
+
real stol_;
|
|
44
|
+
real _a, _f, _f1, _f12, _e2, _es, _e12, _n, _b;
|
|
45
|
+
TransverseMercator _tm;
|
|
46
|
+
EllipticFunction _ell;
|
|
47
|
+
AlbersEqualArea _au;
|
|
48
|
+
|
|
49
|
+
// These are the alpha and beta coefficients in the Krueger series from
|
|
50
|
+
// TransverseMercator. Thy are used by RhumbSolve to compute
|
|
51
|
+
// (psi2-psi1)/(mu2-mu1).
|
|
52
|
+
const Math::real* ConformalToRectifyingCoeffs() const { return _tm._alp; }
|
|
53
|
+
const Math::real* RectifyingToConformalCoeffs() const { return _tm._bet; }
|
|
54
|
+
friend class Rhumb; friend class RhumbLine;
|
|
55
|
+
public:
|
|
56
|
+
/** \name Constructor
|
|
57
|
+
**********************************************************************/
|
|
58
|
+
///@{
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Constructor for a ellipsoid with
|
|
62
|
+
*
|
|
63
|
+
* @param[in] a equatorial radius (meters).
|
|
64
|
+
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphere.
|
|
65
|
+
* Negative \e f gives a prolate ellipsoid.
|
|
66
|
+
* @exception GeographicErr if \e a or (1 − \e f) \e a is not
|
|
67
|
+
* positive.
|
|
68
|
+
**********************************************************************/
|
|
69
|
+
Ellipsoid(real a, real f);
|
|
70
|
+
///@}
|
|
71
|
+
|
|
72
|
+
/** \name %Ellipsoid dimensions.
|
|
73
|
+
**********************************************************************/
|
|
74
|
+
///@{
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @return \e a the equatorial radius of the ellipsoid (meters). This is
|
|
78
|
+
* the value used in the constructor.
|
|
79
|
+
**********************************************************************/
|
|
80
|
+
Math::real MajorRadius() const { return _a; }
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @return \e b the polar semi-axis (meters).
|
|
84
|
+
**********************************************************************/
|
|
85
|
+
Math::real MinorRadius() const { return _b; }
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* @return \e L the distance between the equator and a pole along a
|
|
89
|
+
* meridian (meters). For a sphere \e L = (π/2) \e a. The radius
|
|
90
|
+
* of a sphere with the same meridian length is \e L / (π/2).
|
|
91
|
+
**********************************************************************/
|
|
92
|
+
Math::real QuarterMeridian() const;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @return \e A the total area of the ellipsoid (meters<sup>2</sup>). For
|
|
96
|
+
* a sphere \e A = 4π <i>a</i><sup>2</sup>. The radius of a sphere
|
|
97
|
+
* with the same area is sqrt(\e A / (4π)).
|
|
98
|
+
**********************************************************************/
|
|
99
|
+
Math::real Area() const;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* @return \e V the total volume of the ellipsoid (meters<sup>3</sup>).
|
|
103
|
+
* For a sphere \e V = (4π / 3) <i>a</i><sup>3</sup>. The radius of
|
|
104
|
+
* a sphere with the same volume is cbrt(\e V / (4π/3)).
|
|
105
|
+
**********************************************************************/
|
|
106
|
+
Math::real Volume() const
|
|
107
|
+
{ return (4 * Math::pi()) * Math::sq(_a) * _b / 3; }
|
|
108
|
+
///@}
|
|
109
|
+
|
|
110
|
+
/** \name %Ellipsoid shape
|
|
111
|
+
**********************************************************************/
|
|
112
|
+
///@{
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @return \e f = (\e a − \e b) / \e a, the flattening of the
|
|
116
|
+
* ellipsoid. This is the value used in the constructor. This is zero,
|
|
117
|
+
* positive, or negative for a sphere, oblate ellipsoid, or prolate
|
|
118
|
+
* ellipsoid.
|
|
119
|
+
**********************************************************************/
|
|
120
|
+
Math::real Flattening() const { return _f; }
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @return \e f ' = (\e a − \e b) / \e b, the second flattening of
|
|
124
|
+
* the ellipsoid. This is zero, positive, or negative for a sphere,
|
|
125
|
+
* oblate ellipsoid, or prolate ellipsoid.
|
|
126
|
+
**********************************************************************/
|
|
127
|
+
Math::real SecondFlattening() const { return _f / (1 - _f); }
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @return \e n = (\e a − \e b) / (\e a + \e b), the third flattening
|
|
131
|
+
* of the ellipsoid. This is zero, positive, or negative for a sphere,
|
|
132
|
+
* oblate ellipsoid, or prolate ellipsoid.
|
|
133
|
+
**********************************************************************/
|
|
134
|
+
Math::real ThirdFlattening() const { return _n; }
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @return <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
138
|
+
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity squared
|
|
139
|
+
* of the ellipsoid. This is zero, positive, or negative for a sphere,
|
|
140
|
+
* oblate ellipsoid, or prolate ellipsoid.
|
|
141
|
+
**********************************************************************/
|
|
142
|
+
Math::real EccentricitySq() const { return _e2; }
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @return <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
146
|
+
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
|
|
147
|
+
* squared of the ellipsoid. This is zero, positive, or negative for a
|
|
148
|
+
* sphere, oblate ellipsoid, or prolate ellipsoid.
|
|
149
|
+
**********************************************************************/
|
|
150
|
+
Math::real SecondEccentricitySq() const { return _e12; }
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* @return <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
154
|
+
* <i>b</i><sup>2</sup>) / (<i>a</i><sup>2</sup> + <i>b</i><sup>2</sup>),
|
|
155
|
+
* the third eccentricity squared of the ellipsoid. This is zero,
|
|
156
|
+
* positive, or negative for a sphere, oblate ellipsoid, or prolate
|
|
157
|
+
* ellipsoid.
|
|
158
|
+
**********************************************************************/
|
|
159
|
+
Math::real ThirdEccentricitySq() const { return _e2 / (2 - _e2); }
|
|
160
|
+
///@}
|
|
161
|
+
|
|
162
|
+
/** \name Latitude conversion.
|
|
163
|
+
**********************************************************************/
|
|
164
|
+
///@{
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
168
|
+
* @return β the parametric latitude (degrees).
|
|
169
|
+
*
|
|
170
|
+
* The geographic latitude, φ, is the angle beween the equatorial
|
|
171
|
+
* plane and a vector normal to the surface of the ellipsoid.
|
|
172
|
+
*
|
|
173
|
+
* The parametric latitude (also called the reduced latitude), β,
|
|
174
|
+
* allows the cartesian coordinated of a meridian to be expressed
|
|
175
|
+
* conveniently in parametric form as
|
|
176
|
+
* - \e R = \e a cos β
|
|
177
|
+
* - \e Z = \e b sin β
|
|
178
|
+
* .
|
|
179
|
+
* where \e a and \e b are the equatorial radius and the polar semi-axis.
|
|
180
|
+
* For a sphere β = φ.
|
|
181
|
+
*
|
|
182
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
183
|
+
* result is undefined if this condition does not hold. The returned value
|
|
184
|
+
* β lies in [−90°, 90°].
|
|
185
|
+
**********************************************************************/
|
|
186
|
+
Math::real ParametricLatitude(real phi) const;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @param[in] beta the parametric latitude (degrees).
|
|
190
|
+
* @return φ the geographic latitude (degrees).
|
|
191
|
+
*
|
|
192
|
+
* β must lie in the range [−90°, 90°]; the
|
|
193
|
+
* result is undefined if this condition does not hold. The returned value
|
|
194
|
+
* φ lies in [−90°, 90°].
|
|
195
|
+
**********************************************************************/
|
|
196
|
+
Math::real InverseParametricLatitude(real beta) const;
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
200
|
+
* @return θ the geocentric latitude (degrees).
|
|
201
|
+
*
|
|
202
|
+
* The geocentric latitude, θ, is the angle beween the equatorial
|
|
203
|
+
* plane and a line between the center of the ellipsoid and a point on the
|
|
204
|
+
* ellipsoid. For a sphere θ = φ.
|
|
205
|
+
*
|
|
206
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
207
|
+
* result is undefined if this condition does not hold. The returned value
|
|
208
|
+
* θ lies in [−90°, 90°].
|
|
209
|
+
**********************************************************************/
|
|
210
|
+
Math::real GeocentricLatitude(real phi) const;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* @param[in] theta the geocentric latitude (degrees).
|
|
214
|
+
* @return φ the geographic latitude (degrees).
|
|
215
|
+
*
|
|
216
|
+
* θ must lie in the range [−90°, 90°]; the
|
|
217
|
+
* result is undefined if this condition does not hold. The returned value
|
|
218
|
+
* φ lies in [−90°, 90°].
|
|
219
|
+
**********************************************************************/
|
|
220
|
+
Math::real InverseGeocentricLatitude(real theta) const;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
224
|
+
* @return μ the rectifying latitude (degrees).
|
|
225
|
+
*
|
|
226
|
+
* The rectifying latitude, μ, has the property that the distance along
|
|
227
|
+
* a meridian of the ellipsoid between two points with rectifying latitudes
|
|
228
|
+
* μ<sub>1</sub> and μ<sub>2</sub> is equal to
|
|
229
|
+
* (μ<sub>2</sub> - μ<sub>1</sub>) \e L / 90°,
|
|
230
|
+
* where \e L = QuarterMeridian(). For a sphere μ = φ.
|
|
231
|
+
*
|
|
232
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
233
|
+
* result is undefined if this condition does not hold. The returned value
|
|
234
|
+
* μ lies in [−90°, 90°].
|
|
235
|
+
**********************************************************************/
|
|
236
|
+
Math::real RectifyingLatitude(real phi) const;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @param[in] mu the rectifying latitude (degrees).
|
|
240
|
+
* @return φ the geographic latitude (degrees).
|
|
241
|
+
*
|
|
242
|
+
* μ must lie in the range [−90°, 90°]; the
|
|
243
|
+
* result is undefined if this condition does not hold. The returned value
|
|
244
|
+
* φ lies in [−90°, 90°].
|
|
245
|
+
**********************************************************************/
|
|
246
|
+
Math::real InverseRectifyingLatitude(real mu) const;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
250
|
+
* @return ξ the authalic latitude (degrees).
|
|
251
|
+
*
|
|
252
|
+
* The authalic latitude, ξ, has the property that the area of the
|
|
253
|
+
* ellipsoid between two circles with authalic latitudes
|
|
254
|
+
* ξ<sub>1</sub> and ξ<sub>2</sub> is equal to (sin
|
|
255
|
+
* ξ<sub>2</sub> - sin ξ<sub>1</sub>) \e A / 2, where \e A
|
|
256
|
+
* = Area(). For a sphere ξ = φ.
|
|
257
|
+
*
|
|
258
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
259
|
+
* result is undefined if this condition does not hold. The returned value
|
|
260
|
+
* ξ lies in [−90°, 90°].
|
|
261
|
+
**********************************************************************/
|
|
262
|
+
Math::real AuthalicLatitude(real phi) const;
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* @param[in] xi the authalic latitude (degrees).
|
|
266
|
+
* @return φ the geographic latitude (degrees).
|
|
267
|
+
*
|
|
268
|
+
* ξ must lie in the range [−90°, 90°]; the
|
|
269
|
+
* result is undefined if this condition does not hold. The returned value
|
|
270
|
+
* φ lies in [−90°, 90°].
|
|
271
|
+
**********************************************************************/
|
|
272
|
+
Math::real InverseAuthalicLatitude(real xi) const;
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
276
|
+
* @return χ the conformal latitude (degrees).
|
|
277
|
+
*
|
|
278
|
+
* The conformal latitude, χ, gives the mapping of the ellipsoid to a
|
|
279
|
+
* sphere which which is conformal (angles are preserved) and in which the
|
|
280
|
+
* equator of the ellipsoid maps to the equator of the sphere. For a
|
|
281
|
+
* sphere χ = φ.
|
|
282
|
+
*
|
|
283
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
284
|
+
* result is undefined if this condition does not hold. The returned value
|
|
285
|
+
* χ lies in [−90°, 90°].
|
|
286
|
+
**********************************************************************/
|
|
287
|
+
Math::real ConformalLatitude(real phi) const;
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* @param[in] chi the conformal latitude (degrees).
|
|
291
|
+
* @return φ the geographic latitude (degrees).
|
|
292
|
+
*
|
|
293
|
+
* χ must lie in the range [−90°, 90°]; the
|
|
294
|
+
* result is undefined if this condition does not hold. The returned value
|
|
295
|
+
* φ lies in [−90°, 90°].
|
|
296
|
+
**********************************************************************/
|
|
297
|
+
Math::real InverseConformalLatitude(real chi) const;
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
301
|
+
* @return ψ the isometric latitude (degrees).
|
|
302
|
+
*
|
|
303
|
+
* The isometric latitude gives the mapping of the ellipsoid to a plane
|
|
304
|
+
* which which is conformal (angles are preserved) and in which the equator
|
|
305
|
+
* of the ellipsoid maps to a straight line of constant scale; this mapping
|
|
306
|
+
* defines the Mercator projection. For a sphere ψ =
|
|
307
|
+
* sinh<sup>−1</sup> tan φ.
|
|
308
|
+
*
|
|
309
|
+
* φ must lie in the range [−90°, 90°]; the result is
|
|
310
|
+
* undefined if this condition does not hold. The value returned for φ
|
|
311
|
+
* = ±90° is some (positive or negative) large but finite value,
|
|
312
|
+
* such that InverseIsometricLatitude returns the original value of φ.
|
|
313
|
+
**********************************************************************/
|
|
314
|
+
Math::real IsometricLatitude(real phi) const;
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* @param[in] psi the isometric latitude (degrees).
|
|
318
|
+
* @return φ the geographic latitude (degrees).
|
|
319
|
+
*
|
|
320
|
+
* The returned value φ lies in [−90°, 90°]. For a
|
|
321
|
+
* sphere φ = tan<sup>−1</sup> sinh ψ.
|
|
322
|
+
**********************************************************************/
|
|
323
|
+
Math::real InverseIsometricLatitude(real psi) const;
|
|
324
|
+
///@}
|
|
325
|
+
|
|
326
|
+
/** \name Other quantities.
|
|
327
|
+
**********************************************************************/
|
|
328
|
+
///@{
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
332
|
+
* @return \e R = \e a cos β the radius of a circle of latitude
|
|
333
|
+
* φ (meters). \e R (π/180°) gives meters per degree
|
|
334
|
+
* longitude measured along a circle of latitude.
|
|
335
|
+
*
|
|
336
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
337
|
+
* result is undefined if this condition does not hold.
|
|
338
|
+
**********************************************************************/
|
|
339
|
+
Math::real CircleRadius(real phi) const;
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
343
|
+
* @return \e Z = \e b sin β the distance of a circle of latitude
|
|
344
|
+
* φ from the equator measured parallel to the ellipsoid axis
|
|
345
|
+
* (meters).
|
|
346
|
+
*
|
|
347
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
348
|
+
* result is undefined if this condition does not hold.
|
|
349
|
+
**********************************************************************/
|
|
350
|
+
Math::real CircleHeight(real phi) const;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
354
|
+
* @return \e s the distance along a meridian
|
|
355
|
+
* between the equator and a point of latitude φ (meters). \e s is
|
|
356
|
+
* given by \e s = μ \e L / 90°, where \e L =
|
|
357
|
+
* QuarterMeridian()).
|
|
358
|
+
*
|
|
359
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
360
|
+
* result is undefined if this condition does not hold.
|
|
361
|
+
**********************************************************************/
|
|
362
|
+
Math::real MeridianDistance(real phi) const;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
366
|
+
* @return ρ the meridional radius of curvature of the ellipsoid at
|
|
367
|
+
* latitude φ (meters); this is the curvature of the meridian. \e
|
|
368
|
+
* rho is given by ρ = (180°/π) d\e s / dφ,
|
|
369
|
+
* where \e s = MeridianDistance(); thus ρ (π/180°)
|
|
370
|
+
* gives meters per degree latitude measured along a meridian.
|
|
371
|
+
*
|
|
372
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
373
|
+
* result is undefined if this condition does not hold.
|
|
374
|
+
**********************************************************************/
|
|
375
|
+
Math::real MeridionalCurvatureRadius(real phi) const;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
379
|
+
* @return ν the transverse radius of curvature of the ellipsoid at
|
|
380
|
+
* latitude φ (meters); this is the curvature of a curve on the
|
|
381
|
+
* ellipsoid which also lies in a plane perpendicular to the ellipsoid
|
|
382
|
+
* and to the meridian. ν is related to \e R = CircleRadius() by \e
|
|
383
|
+
* R = ν cos φ.
|
|
384
|
+
*
|
|
385
|
+
* φ must lie in the range [−90°, 90°]; the
|
|
386
|
+
* result is undefined if this condition does not hold.
|
|
387
|
+
**********************************************************************/
|
|
388
|
+
Math::real TransverseCurvatureRadius(real phi) const;
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @param[in] phi the geographic latitude (degrees).
|
|
392
|
+
* @param[in] azi the angle between the meridian and the normal section
|
|
393
|
+
* (degrees).
|
|
394
|
+
* @return the radius of curvature of the ellipsoid in the normal
|
|
395
|
+
* section at latitude φ inclined at an angle \e azi to the
|
|
396
|
+
* meridian (meters).
|
|
397
|
+
*
|
|
398
|
+
* φ must lie in the range [−90°, 90°]; the result is
|
|
399
|
+
* undefined this condition does not hold.
|
|
400
|
+
**********************************************************************/
|
|
401
|
+
Math::real NormalCurvatureRadius(real phi, real azi) const;
|
|
402
|
+
///@}
|
|
403
|
+
|
|
404
|
+
/** \name Eccentricity conversions.
|
|
405
|
+
**********************************************************************/
|
|
406
|
+
///@{
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* @param[in] fp = \e f ' = (\e a − \e b) / \e b, the second
|
|
410
|
+
* flattening.
|
|
411
|
+
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
|
412
|
+
*
|
|
413
|
+
* \e f ' should lie in (−1, ∞).
|
|
414
|
+
* The returned value \e f lies in (−∞, 1).
|
|
415
|
+
**********************************************************************/
|
|
416
|
+
static Math::real SecondFlatteningToFlattening(real fp)
|
|
417
|
+
{ return fp / (1 + fp); }
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
|
421
|
+
* @return \e f ' = (\e a − \e b) / \e b, the second flattening.
|
|
422
|
+
*
|
|
423
|
+
* \e f should lie in (−∞, 1).
|
|
424
|
+
* The returned value \e f ' lies in (−1, ∞).
|
|
425
|
+
**********************************************************************/
|
|
426
|
+
static Math::real FlatteningToSecondFlattening(real f)
|
|
427
|
+
{ return f / (1 - f); }
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* @param[in] n = (\e a − \e b) / (\e a + \e b), the third
|
|
431
|
+
* flattening.
|
|
432
|
+
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
|
433
|
+
*
|
|
434
|
+
* \e n should lie in (−1, 1).
|
|
435
|
+
* The returned value \e f lies in (−∞, 1).
|
|
436
|
+
**********************************************************************/
|
|
437
|
+
static Math::real ThirdFlatteningToFlattening(real n)
|
|
438
|
+
{ return 2 * n / (1 + n); }
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
|
442
|
+
* @return \e n = (\e a − \e b) / (\e a + \e b), the third
|
|
443
|
+
* flattening.
|
|
444
|
+
*
|
|
445
|
+
* \e f should lie in (−∞, 1).
|
|
446
|
+
* The returned value \e n lies in (−1, 1).
|
|
447
|
+
**********************************************************************/
|
|
448
|
+
static Math::real FlatteningToThirdFlattening(real f)
|
|
449
|
+
{ return f / (2 - f); }
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* @param[in] e2 = <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
453
|
+
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
|
|
454
|
+
* squared.
|
|
455
|
+
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
|
456
|
+
*
|
|
457
|
+
* <i>e</i><sup>2</sup> should lie in (−∞, 1).
|
|
458
|
+
* The returned value \e f lies in (−∞, 1).
|
|
459
|
+
**********************************************************************/
|
|
460
|
+
static Math::real EccentricitySqToFlattening(real e2)
|
|
461
|
+
{ using std::sqrt; return e2 / (sqrt(1 - e2) + 1); }
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
|
465
|
+
* @return <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
466
|
+
* <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
|
|
467
|
+
* squared.
|
|
468
|
+
*
|
|
469
|
+
* \e f should lie in (−∞, 1).
|
|
470
|
+
* The returned value <i>e</i><sup>2</sup> lies in (−∞, 1).
|
|
471
|
+
**********************************************************************/
|
|
472
|
+
static Math::real FlatteningToEccentricitySq(real f)
|
|
473
|
+
{ return f * (2 - f); }
|
|
474
|
+
|
|
475
|
+
/**
|
|
476
|
+
* @param[in] ep2 = <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
477
|
+
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
|
|
478
|
+
* squared.
|
|
479
|
+
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
|
480
|
+
*
|
|
481
|
+
* <i>e'</i> <sup>2</sup> should lie in (−1, ∞).
|
|
482
|
+
* The returned value \e f lies in (−∞, 1).
|
|
483
|
+
**********************************************************************/
|
|
484
|
+
static Math::real SecondEccentricitySqToFlattening(real ep2)
|
|
485
|
+
{ using std::sqrt; return ep2 / (sqrt(1 + ep2) + 1 + ep2); }
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
|
489
|
+
* @return <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
490
|
+
* <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
|
|
491
|
+
* squared.
|
|
492
|
+
*
|
|
493
|
+
* \e f should lie in (−∞, 1).
|
|
494
|
+
* The returned value <i>e'</i> <sup>2</sup> lies in (−1, ∞).
|
|
495
|
+
**********************************************************************/
|
|
496
|
+
static Math::real FlatteningToSecondEccentricitySq(real f)
|
|
497
|
+
{ return f * (2 - f) / Math::sq(1 - f); }
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* @param[in] epp2 = <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup>
|
|
501
|
+
* − <i>b</i><sup>2</sup>) / (<i>a</i><sup>2</sup> +
|
|
502
|
+
* <i>b</i><sup>2</sup>), the third eccentricity squared.
|
|
503
|
+
* @return \e f = (\e a − \e b) / \e a, the flattening.
|
|
504
|
+
*
|
|
505
|
+
* <i>e''</i> <sup>2</sup> should lie in (−1, 1).
|
|
506
|
+
* The returned value \e f lies in (−∞, 1).
|
|
507
|
+
**********************************************************************/
|
|
508
|
+
static Math::real ThirdEccentricitySqToFlattening(real epp2)
|
|
509
|
+
{ return 2 * epp2 / (sqrt((1 - epp2) * (1 + epp2)) + 1 + epp2); }
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* @param[in] f = (\e a − \e b) / \e a, the flattening.
|
|
513
|
+
* @return <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup> −
|
|
514
|
+
* <i>b</i><sup>2</sup>) / (<i>a</i><sup>2</sup> + <i>b</i><sup>2</sup>),
|
|
515
|
+
* the third eccentricity squared.
|
|
516
|
+
*
|
|
517
|
+
* \e f should lie in (−∞, 1).
|
|
518
|
+
* The returned value <i>e''</i> <sup>2</sup> lies in (−1, 1).
|
|
519
|
+
**********************************************************************/
|
|
520
|
+
static Math::real FlatteningToThirdEccentricitySq(real f)
|
|
521
|
+
{ return f * (2 - f) / (1 + Math::sq(1 - f)); }
|
|
522
|
+
|
|
523
|
+
///@}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* A global instantiation of Ellipsoid with the parameters for the WGS84
|
|
527
|
+
* ellipsoid.
|
|
528
|
+
**********************************************************************/
|
|
529
|
+
static const Ellipsoid& WGS84();
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
} // namespace GeographicLib
|
|
533
|
+
|
|
534
|
+
#endif // GEOGRAPHICLIB_ELLIPSOID_HPP
|