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.
Files changed (87) hide show
  1. checksums.yaml +7 -0
  2. data/AUTHORS +12 -0
  3. data/LICENSE +24 -0
  4. data/ext/geographiclib/Accumulator.cpp +23 -0
  5. data/ext/geographiclib/AlbersEqualArea.cpp +445 -0
  6. data/ext/geographiclib/AzimuthalEquidistant.cpp +41 -0
  7. data/ext/geographiclib/CassiniSoldner.cpp +89 -0
  8. data/ext/geographiclib/CircularEngine.cpp +96 -0
  9. data/ext/geographiclib/DMS.cpp +381 -0
  10. data/ext/geographiclib/Ellipsoid.cpp +125 -0
  11. data/ext/geographiclib/EllipticFunction.cpp +512 -0
  12. data/ext/geographiclib/GARS.cpp +122 -0
  13. data/ext/geographiclib/GeoCoords.cpp +175 -0
  14. data/ext/geographiclib/Geocentric.cpp +172 -0
  15. data/ext/geographiclib/Geodesic.cpp +1908 -0
  16. data/ext/geographiclib/GeodesicExact.cpp +927 -0
  17. data/ext/geographiclib/GeodesicExactC4.cpp +7879 -0
  18. data/ext/geographiclib/GeodesicLine.cpp +321 -0
  19. data/ext/geographiclib/GeodesicLineExact.cpp +289 -0
  20. data/ext/geographiclib/GeographicLib/Accumulator.hpp +184 -0
  21. data/ext/geographiclib/GeographicLib/AlbersEqualArea.hpp +312 -0
  22. data/ext/geographiclib/GeographicLib/AzimuthalEquidistant.hpp +139 -0
  23. data/ext/geographiclib/GeographicLib/CassiniSoldner.hpp +204 -0
  24. data/ext/geographiclib/GeographicLib/CircularEngine.hpp +195 -0
  25. data/ext/geographiclib/GeographicLib/Config.h +12 -0
  26. data/ext/geographiclib/GeographicLib/Constants.hpp +387 -0
  27. data/ext/geographiclib/GeographicLib/DMS.hpp +370 -0
  28. data/ext/geographiclib/GeographicLib/Ellipsoid.hpp +534 -0
  29. data/ext/geographiclib/GeographicLib/EllipticFunction.hpp +692 -0
  30. data/ext/geographiclib/GeographicLib/GARS.hpp +143 -0
  31. data/ext/geographiclib/GeographicLib/GeoCoords.hpp +544 -0
  32. data/ext/geographiclib/GeographicLib/Geocentric.hpp +267 -0
  33. data/ext/geographiclib/GeographicLib/Geodesic.hpp +970 -0
  34. data/ext/geographiclib/GeographicLib/GeodesicExact.hpp +862 -0
  35. data/ext/geographiclib/GeographicLib/GeodesicLine.hpp +701 -0
  36. data/ext/geographiclib/GeographicLib/GeodesicLineExact.hpp +667 -0
  37. data/ext/geographiclib/GeographicLib/Geohash.hpp +180 -0
  38. data/ext/geographiclib/GeographicLib/Geoid.hpp +472 -0
  39. data/ext/geographiclib/GeographicLib/Georef.hpp +160 -0
  40. data/ext/geographiclib/GeographicLib/Gnomonic.hpp +206 -0
  41. data/ext/geographiclib/GeographicLib/GravityCircle.hpp +301 -0
  42. data/ext/geographiclib/GeographicLib/GravityModel.hpp +520 -0
  43. data/ext/geographiclib/GeographicLib/LambertConformalConic.hpp +313 -0
  44. data/ext/geographiclib/GeographicLib/LocalCartesian.hpp +236 -0
  45. data/ext/geographiclib/GeographicLib/MGRS.hpp +355 -0
  46. data/ext/geographiclib/GeographicLib/MagneticCircle.hpp +178 -0
  47. data/ext/geographiclib/GeographicLib/MagneticModel.hpp +347 -0
  48. data/ext/geographiclib/GeographicLib/Math.hpp +920 -0
  49. data/ext/geographiclib/GeographicLib/NormalGravity.hpp +350 -0
  50. data/ext/geographiclib/GeographicLib/OSGB.hpp +249 -0
  51. data/ext/geographiclib/GeographicLib/PolarStereographic.hpp +150 -0
  52. data/ext/geographiclib/GeographicLib/PolygonArea.hpp +288 -0
  53. data/ext/geographiclib/GeographicLib/Rhumb.hpp +589 -0
  54. data/ext/geographiclib/GeographicLib/SphericalEngine.hpp +376 -0
  55. data/ext/geographiclib/GeographicLib/SphericalHarmonic.hpp +354 -0
  56. data/ext/geographiclib/GeographicLib/SphericalHarmonic1.hpp +281 -0
  57. data/ext/geographiclib/GeographicLib/SphericalHarmonic2.hpp +315 -0
  58. data/ext/geographiclib/GeographicLib/TransverseMercator.hpp +196 -0
  59. data/ext/geographiclib/GeographicLib/TransverseMercatorExact.hpp +254 -0
  60. data/ext/geographiclib/GeographicLib/UTMUPS.hpp +421 -0
  61. data/ext/geographiclib/GeographicLib/Utility.hpp +612 -0
  62. data/ext/geographiclib/Geohash.cpp +102 -0
  63. data/ext/geographiclib/Geoid.cpp +509 -0
  64. data/ext/geographiclib/Georef.cpp +135 -0
  65. data/ext/geographiclib/Gnomonic.cpp +85 -0
  66. data/ext/geographiclib/GravityCircle.cpp +129 -0
  67. data/ext/geographiclib/GravityModel.cpp +360 -0
  68. data/ext/geographiclib/LambertConformalConic.cpp +456 -0
  69. data/ext/geographiclib/LocalCartesian.cpp +62 -0
  70. data/ext/geographiclib/MGRS.cpp +461 -0
  71. data/ext/geographiclib/MagneticCircle.cpp +52 -0
  72. data/ext/geographiclib/MagneticModel.cpp +269 -0
  73. data/ext/geographiclib/Math.cpp +63 -0
  74. data/ext/geographiclib/NormalGravity.cpp +262 -0
  75. data/ext/geographiclib/OSGB.cpp +167 -0
  76. data/ext/geographiclib/PolarStereographic.cpp +108 -0
  77. data/ext/geographiclib/PolygonArea.cpp +204 -0
  78. data/ext/geographiclib/Rhumb.cpp +383 -0
  79. data/ext/geographiclib/SphericalEngine.cpp +477 -0
  80. data/ext/geographiclib/TransverseMercator.cpp +603 -0
  81. data/ext/geographiclib/TransverseMercatorExact.cpp +464 -0
  82. data/ext/geographiclib/UTMUPS.cpp +296 -0
  83. data/ext/geographiclib/Utility.cpp +61 -0
  84. data/ext/geographiclib/extconf.rb +3 -0
  85. data/ext/geographiclib/geographiclib.cpp +62 -0
  86. data/lib/geographiclib.rb +20 -0
  87. 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 &minus;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 &minus; \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 = (&pi;/2) \e a. The radius
90
+ * of a sphere with the same meridian length is \e L / (&pi;/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&pi; <i>a</i><sup>2</sup>. The radius of a sphere
97
+ * with the same area is sqrt(\e A / (4&pi;)).
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&pi; / 3) <i>a</i><sup>3</sup>. The radius of
104
+ * a sphere with the same volume is cbrt(\e V / (4&pi;/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 &minus; \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 &minus; \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 &minus; \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> &minus;
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> &minus;
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> &minus;
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 &beta; the parametric latitude (degrees).
169
+ *
170
+ * The geographic latitude, &phi;, 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), &beta;,
174
+ * allows the cartesian coordinated of a meridian to be expressed
175
+ * conveniently in parametric form as
176
+ * - \e R = \e a cos &beta;
177
+ * - \e Z = \e b sin &beta;
178
+ * .
179
+ * where \e a and \e b are the equatorial radius and the polar semi-axis.
180
+ * For a sphere &beta; = &phi;.
181
+ *
182
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
183
+ * result is undefined if this condition does not hold. The returned value
184
+ * &beta; lies in [&minus;90&deg;, 90&deg;].
185
+ **********************************************************************/
186
+ Math::real ParametricLatitude(real phi) const;
187
+
188
+ /**
189
+ * @param[in] beta the parametric latitude (degrees).
190
+ * @return &phi; the geographic latitude (degrees).
191
+ *
192
+ * &beta; must lie in the range [&minus;90&deg;, 90&deg;]; the
193
+ * result is undefined if this condition does not hold. The returned value
194
+ * &phi; lies in [&minus;90&deg;, 90&deg;].
195
+ **********************************************************************/
196
+ Math::real InverseParametricLatitude(real beta) const;
197
+
198
+ /**
199
+ * @param[in] phi the geographic latitude (degrees).
200
+ * @return &theta; the geocentric latitude (degrees).
201
+ *
202
+ * The geocentric latitude, &theta;, 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 &theta; = &phi;.
205
+ *
206
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
207
+ * result is undefined if this condition does not hold. The returned value
208
+ * &theta; lies in [&minus;90&deg;, 90&deg;].
209
+ **********************************************************************/
210
+ Math::real GeocentricLatitude(real phi) const;
211
+
212
+ /**
213
+ * @param[in] theta the geocentric latitude (degrees).
214
+ * @return &phi; the geographic latitude (degrees).
215
+ *
216
+ * &theta; must lie in the range [&minus;90&deg;, 90&deg;]; the
217
+ * result is undefined if this condition does not hold. The returned value
218
+ * &phi; lies in [&minus;90&deg;, 90&deg;].
219
+ **********************************************************************/
220
+ Math::real InverseGeocentricLatitude(real theta) const;
221
+
222
+ /**
223
+ * @param[in] phi the geographic latitude (degrees).
224
+ * @return &mu; the rectifying latitude (degrees).
225
+ *
226
+ * The rectifying latitude, &mu;, has the property that the distance along
227
+ * a meridian of the ellipsoid between two points with rectifying latitudes
228
+ * &mu;<sub>1</sub> and &mu;<sub>2</sub> is equal to
229
+ * (&mu;<sub>2</sub> - &mu;<sub>1</sub>) \e L / 90&deg;,
230
+ * where \e L = QuarterMeridian(). For a sphere &mu; = &phi;.
231
+ *
232
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
233
+ * result is undefined if this condition does not hold. The returned value
234
+ * &mu; lies in [&minus;90&deg;, 90&deg;].
235
+ **********************************************************************/
236
+ Math::real RectifyingLatitude(real phi) const;
237
+
238
+ /**
239
+ * @param[in] mu the rectifying latitude (degrees).
240
+ * @return &phi; the geographic latitude (degrees).
241
+ *
242
+ * &mu; must lie in the range [&minus;90&deg;, 90&deg;]; the
243
+ * result is undefined if this condition does not hold. The returned value
244
+ * &phi; lies in [&minus;90&deg;, 90&deg;].
245
+ **********************************************************************/
246
+ Math::real InverseRectifyingLatitude(real mu) const;
247
+
248
+ /**
249
+ * @param[in] phi the geographic latitude (degrees).
250
+ * @return &xi; the authalic latitude (degrees).
251
+ *
252
+ * The authalic latitude, &xi;, has the property that the area of the
253
+ * ellipsoid between two circles with authalic latitudes
254
+ * &xi;<sub>1</sub> and &xi;<sub>2</sub> is equal to (sin
255
+ * &xi;<sub>2</sub> - sin &xi;<sub>1</sub>) \e A / 2, where \e A
256
+ * = Area(). For a sphere &xi; = &phi;.
257
+ *
258
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
259
+ * result is undefined if this condition does not hold. The returned value
260
+ * &xi; lies in [&minus;90&deg;, 90&deg;].
261
+ **********************************************************************/
262
+ Math::real AuthalicLatitude(real phi) const;
263
+
264
+ /**
265
+ * @param[in] xi the authalic latitude (degrees).
266
+ * @return &phi; the geographic latitude (degrees).
267
+ *
268
+ * &xi; must lie in the range [&minus;90&deg;, 90&deg;]; the
269
+ * result is undefined if this condition does not hold. The returned value
270
+ * &phi; lies in [&minus;90&deg;, 90&deg;].
271
+ **********************************************************************/
272
+ Math::real InverseAuthalicLatitude(real xi) const;
273
+
274
+ /**
275
+ * @param[in] phi the geographic latitude (degrees).
276
+ * @return &chi; the conformal latitude (degrees).
277
+ *
278
+ * The conformal latitude, &chi;, 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 &chi; = &phi;.
282
+ *
283
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the
284
+ * result is undefined if this condition does not hold. The returned value
285
+ * &chi; lies in [&minus;90&deg;, 90&deg;].
286
+ **********************************************************************/
287
+ Math::real ConformalLatitude(real phi) const;
288
+
289
+ /**
290
+ * @param[in] chi the conformal latitude (degrees).
291
+ * @return &phi; the geographic latitude (degrees).
292
+ *
293
+ * &chi; must lie in the range [&minus;90&deg;, 90&deg;]; the
294
+ * result is undefined if this condition does not hold. The returned value
295
+ * &phi; lies in [&minus;90&deg;, 90&deg;].
296
+ **********************************************************************/
297
+ Math::real InverseConformalLatitude(real chi) const;
298
+
299
+ /**
300
+ * @param[in] phi the geographic latitude (degrees).
301
+ * @return &psi; 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 &psi; =
307
+ * sinh<sup>&minus;1</sup> tan &phi;.
308
+ *
309
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; the result is
310
+ * undefined if this condition does not hold. The value returned for &phi;
311
+ * = &plusmn;90&deg; is some (positive or negative) large but finite value,
312
+ * such that InverseIsometricLatitude returns the original value of &phi;.
313
+ **********************************************************************/
314
+ Math::real IsometricLatitude(real phi) const;
315
+
316
+ /**
317
+ * @param[in] psi the isometric latitude (degrees).
318
+ * @return &phi; the geographic latitude (degrees).
319
+ *
320
+ * The returned value &phi; lies in [&minus;90&deg;, 90&deg;]. For a
321
+ * sphere &phi; = tan<sup>&minus;1</sup> sinh &psi;.
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 &beta; the radius of a circle of latitude
333
+ * &phi; (meters). \e R (&pi;/180&deg;) gives meters per degree
334
+ * longitude measured along a circle of latitude.
335
+ *
336
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; 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 &beta; the distance of a circle of latitude
344
+ * &phi; from the equator measured parallel to the ellipsoid axis
345
+ * (meters).
346
+ *
347
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; 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 &phi; (meters). \e s is
356
+ * given by \e s = &mu; \e L / 90&deg;, where \e L =
357
+ * QuarterMeridian()).
358
+ *
359
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; 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 &rho; the meridional radius of curvature of the ellipsoid at
367
+ * latitude &phi; (meters); this is the curvature of the meridian. \e
368
+ * rho is given by &rho; = (180&deg;/&pi;) d\e s / d&phi;,
369
+ * where \e s = MeridianDistance(); thus &rho; (&pi;/180&deg;)
370
+ * gives meters per degree latitude measured along a meridian.
371
+ *
372
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; 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 &nu; the transverse radius of curvature of the ellipsoid at
380
+ * latitude &phi; (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. &nu; is related to \e R = CircleRadius() by \e
383
+ * R = &nu; cos &phi;.
384
+ *
385
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; 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 &phi; inclined at an angle \e azi to the
396
+ * meridian (meters).
397
+ *
398
+ * &phi; must lie in the range [&minus;90&deg;, 90&deg;]; 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 &minus; \e b) / \e b, the second
410
+ * flattening.
411
+ * @return \e f = (\e a &minus; \e b) / \e a, the flattening.
412
+ *
413
+ * \e f ' should lie in (&minus;1, &infin;).
414
+ * The returned value \e f lies in (&minus;&infin;, 1).
415
+ **********************************************************************/
416
+ static Math::real SecondFlatteningToFlattening(real fp)
417
+ { return fp / (1 + fp); }
418
+
419
+ /**
420
+ * @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
421
+ * @return \e f ' = (\e a &minus; \e b) / \e b, the second flattening.
422
+ *
423
+ * \e f should lie in (&minus;&infin;, 1).
424
+ * The returned value \e f ' lies in (&minus;1, &infin;).
425
+ **********************************************************************/
426
+ static Math::real FlatteningToSecondFlattening(real f)
427
+ { return f / (1 - f); }
428
+
429
+ /**
430
+ * @param[in] n = (\e a &minus; \e b) / (\e a + \e b), the third
431
+ * flattening.
432
+ * @return \e f = (\e a &minus; \e b) / \e a, the flattening.
433
+ *
434
+ * \e n should lie in (&minus;1, 1).
435
+ * The returned value \e f lies in (&minus;&infin;, 1).
436
+ **********************************************************************/
437
+ static Math::real ThirdFlatteningToFlattening(real n)
438
+ { return 2 * n / (1 + n); }
439
+
440
+ /**
441
+ * @param[in] f = (\e a &minus; \e b) / \e a, the flattening.
442
+ * @return \e n = (\e a &minus; \e b) / (\e a + \e b), the third
443
+ * flattening.
444
+ *
445
+ * \e f should lie in (&minus;&infin;, 1).
446
+ * The returned value \e n lies in (&minus;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> &minus;
453
+ * <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
454
+ * squared.
455
+ * @return \e f = (\e a &minus; \e b) / \e a, the flattening.
456
+ *
457
+ * <i>e</i><sup>2</sup> should lie in (&minus;&infin;, 1).
458
+ * The returned value \e f lies in (&minus;&infin;, 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 &minus; \e b) / \e a, the flattening.
465
+ * @return <i>e</i><sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
466
+ * <i>b</i><sup>2</sup>) / <i>a</i><sup>2</sup>, the eccentricity
467
+ * squared.
468
+ *
469
+ * \e f should lie in (&minus;&infin;, 1).
470
+ * The returned value <i>e</i><sup>2</sup> lies in (&minus;&infin;, 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> &minus;
477
+ * <i>b</i><sup>2</sup>) / <i>b</i><sup>2</sup>, the second eccentricity
478
+ * squared.
479
+ * @return \e f = (\e a &minus; \e b) / \e a, the flattening.
480
+ *
481
+ * <i>e'</i> <sup>2</sup> should lie in (&minus;1, &infin;).
482
+ * The returned value \e f lies in (&minus;&infin;, 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 &minus; \e b) / \e a, the flattening.
489
+ * @return <i>e'</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
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 (&minus;&infin;, 1).
494
+ * The returned value <i>e'</i> <sup>2</sup> lies in (&minus;1, &infin;).
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
+ * &minus; <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 &minus; \e b) / \e a, the flattening.
504
+ *
505
+ * <i>e''</i> <sup>2</sup> should lie in (&minus;1, 1).
506
+ * The returned value \e f lies in (&minus;&infin;, 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 &minus; \e b) / \e a, the flattening.
513
+ * @return <i>e''</i> <sup>2</sup> = (<i>a</i><sup>2</sup> &minus;
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 (&minus;&infin;, 1).
518
+ * The returned value <i>e''</i> <sup>2</sup> lies in (&minus;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