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,667 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* \file GeodesicLineExact.hpp
|
|
3
|
+
* \brief Header for GeographicLib::GeodesicLineExact class
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Charles Karney (2012-2016) <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_GEODESICLINEEXACT_HPP)
|
|
11
|
+
#define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1
|
|
12
|
+
|
|
13
|
+
#include <GeographicLib/Constants.hpp>
|
|
14
|
+
#include <GeographicLib/GeodesicExact.hpp>
|
|
15
|
+
#include <GeographicLib/EllipticFunction.hpp>
|
|
16
|
+
|
|
17
|
+
namespace GeographicLib {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* \brief An exact geodesic line
|
|
21
|
+
*
|
|
22
|
+
* GeodesicLineExact facilitates the determination of a series of points on a
|
|
23
|
+
* single geodesic. This is a companion to the GeodesicExact class. For
|
|
24
|
+
* additional information on this class see the documentation on the
|
|
25
|
+
* GeodesicLine class.
|
|
26
|
+
*
|
|
27
|
+
* Example of use:
|
|
28
|
+
* \include example-GeodesicLineExact.cpp
|
|
29
|
+
*
|
|
30
|
+
* <a href="GeodSolve.1.html">GeodSolve</a> is a command-line utility
|
|
31
|
+
* providing access to the functionality of GeodesicExact and
|
|
32
|
+
* GeodesicLineExact (via the -E option).
|
|
33
|
+
**********************************************************************/
|
|
34
|
+
|
|
35
|
+
class GEOGRAPHICLIB_EXPORT GeodesicLineExact {
|
|
36
|
+
private:
|
|
37
|
+
typedef Math::real real;
|
|
38
|
+
friend class GeodesicExact;
|
|
39
|
+
static const int nC4_ = GeodesicExact::nC4_;
|
|
40
|
+
|
|
41
|
+
real tiny_;
|
|
42
|
+
real _lat1, _lon1, _azi1;
|
|
43
|
+
real _a, _f, _b, _c2, _f1, _e2, _salp0, _calp0, _k2,
|
|
44
|
+
_salp1, _calp1, _ssig1, _csig1, _dn1, _stau1, _ctau1,
|
|
45
|
+
_somg1, _comg1, _cchi1,
|
|
46
|
+
_A4, _B41, _E0, _D0, _H0, _E1, _D1, _H1;
|
|
47
|
+
real _a13, _s13;
|
|
48
|
+
real _C4a[nC4_]; // all the elements of _C4a are used
|
|
49
|
+
EllipticFunction _E;
|
|
50
|
+
unsigned _caps;
|
|
51
|
+
|
|
52
|
+
void LineInit(const GeodesicExact& g,
|
|
53
|
+
real lat1, real lon1,
|
|
54
|
+
real azi1, real salp1, real calp1,
|
|
55
|
+
unsigned caps);
|
|
56
|
+
GeodesicLineExact(const GeodesicExact& g,
|
|
57
|
+
real lat1, real lon1,
|
|
58
|
+
real azi1, real salp1, real calp1,
|
|
59
|
+
unsigned caps, bool arcmode, real s13_a13);
|
|
60
|
+
|
|
61
|
+
enum captype {
|
|
62
|
+
CAP_NONE = GeodesicExact::CAP_NONE,
|
|
63
|
+
CAP_E = GeodesicExact::CAP_E,
|
|
64
|
+
CAP_D = GeodesicExact::CAP_D,
|
|
65
|
+
CAP_H = GeodesicExact::CAP_H,
|
|
66
|
+
CAP_C4 = GeodesicExact::CAP_C4,
|
|
67
|
+
CAP_ALL = GeodesicExact::CAP_ALL,
|
|
68
|
+
CAP_MASK = GeodesicExact::CAP_MASK,
|
|
69
|
+
OUT_ALL = GeodesicExact::OUT_ALL,
|
|
70
|
+
OUT_MASK = GeodesicExact::OUT_MASK,
|
|
71
|
+
};
|
|
72
|
+
public:
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Bit masks for what calculations to do. They signify to the
|
|
76
|
+
* GeodesicLineExact::GeodesicLineExact constructor and to
|
|
77
|
+
* GeodesicExact::Line what capabilities should be included in the
|
|
78
|
+
* GeodesicLineExact object. This is merely a duplication of
|
|
79
|
+
* GeodesicExact::mask.
|
|
80
|
+
**********************************************************************/
|
|
81
|
+
enum mask {
|
|
82
|
+
/**
|
|
83
|
+
* No capabilities, no output.
|
|
84
|
+
* @hideinitializer
|
|
85
|
+
**********************************************************************/
|
|
86
|
+
NONE = GeodesicExact::NONE,
|
|
87
|
+
/**
|
|
88
|
+
* Calculate latitude \e lat2. (It's not necessary to include this as a
|
|
89
|
+
* capability to GeodesicLineExact because this is included by default.)
|
|
90
|
+
* @hideinitializer
|
|
91
|
+
**********************************************************************/
|
|
92
|
+
LATITUDE = GeodesicExact::LATITUDE,
|
|
93
|
+
/**
|
|
94
|
+
* Calculate longitude \e lon2.
|
|
95
|
+
* @hideinitializer
|
|
96
|
+
**********************************************************************/
|
|
97
|
+
LONGITUDE = GeodesicExact::LONGITUDE,
|
|
98
|
+
/**
|
|
99
|
+
* Calculate azimuths \e azi1 and \e azi2. (It's not necessary to
|
|
100
|
+
* include this as a capability to GeodesicLineExact because this is
|
|
101
|
+
* included by default.)
|
|
102
|
+
* @hideinitializer
|
|
103
|
+
**********************************************************************/
|
|
104
|
+
AZIMUTH = GeodesicExact::AZIMUTH,
|
|
105
|
+
/**
|
|
106
|
+
* Calculate distance \e s12.
|
|
107
|
+
* @hideinitializer
|
|
108
|
+
**********************************************************************/
|
|
109
|
+
DISTANCE = GeodesicExact::DISTANCE,
|
|
110
|
+
/**
|
|
111
|
+
* Allow distance \e s12 to be used as input in the direct geodesic
|
|
112
|
+
* problem.
|
|
113
|
+
* @hideinitializer
|
|
114
|
+
**********************************************************************/
|
|
115
|
+
DISTANCE_IN = GeodesicExact::DISTANCE_IN,
|
|
116
|
+
/**
|
|
117
|
+
* Calculate reduced length \e m12.
|
|
118
|
+
* @hideinitializer
|
|
119
|
+
**********************************************************************/
|
|
120
|
+
REDUCEDLENGTH = GeodesicExact::REDUCEDLENGTH,
|
|
121
|
+
/**
|
|
122
|
+
* Calculate geodesic scales \e M12 and \e M21.
|
|
123
|
+
* @hideinitializer
|
|
124
|
+
**********************************************************************/
|
|
125
|
+
GEODESICSCALE = GeodesicExact::GEODESICSCALE,
|
|
126
|
+
/**
|
|
127
|
+
* Calculate area \e S12.
|
|
128
|
+
* @hideinitializer
|
|
129
|
+
**********************************************************************/
|
|
130
|
+
AREA = GeodesicExact::AREA,
|
|
131
|
+
/**
|
|
132
|
+
* Unroll \e lon2 in the direct calculation.
|
|
133
|
+
* @hideinitializer
|
|
134
|
+
**********************************************************************/
|
|
135
|
+
LONG_UNROLL = GeodesicExact::LONG_UNROLL,
|
|
136
|
+
/**
|
|
137
|
+
* All capabilities, calculate everything. (LONG_UNROLL is not
|
|
138
|
+
* included in this mask.)
|
|
139
|
+
* @hideinitializer
|
|
140
|
+
**********************************************************************/
|
|
141
|
+
ALL = GeodesicExact::ALL,
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/** \name Constructors
|
|
145
|
+
**********************************************************************/
|
|
146
|
+
///@{
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Constructor for a geodesic line staring at latitude \e lat1, longitude
|
|
150
|
+
* \e lon1, and azimuth \e azi1 (all in degrees).
|
|
151
|
+
*
|
|
152
|
+
* @param[in] g A GeodesicExact object used to compute the necessary
|
|
153
|
+
* information about the GeodesicLineExact.
|
|
154
|
+
* @param[in] lat1 latitude of point 1 (degrees).
|
|
155
|
+
* @param[in] lon1 longitude of point 1 (degrees).
|
|
156
|
+
* @param[in] azi1 azimuth at point 1 (degrees).
|
|
157
|
+
* @param[in] caps bitor'ed combination of GeodesicLineExact::mask values
|
|
158
|
+
* specifying the capabilities the GeodesicLineExact object should
|
|
159
|
+
* possess, i.e., which quantities can be returned in calls to
|
|
160
|
+
* GeodesicLine::Position.
|
|
161
|
+
*
|
|
162
|
+
* \e lat1 should be in the range [−90°, 90°].
|
|
163
|
+
*
|
|
164
|
+
* The GeodesicLineExact::mask values are
|
|
165
|
+
* - \e caps |= GeodesicLineExact::LATITUDE for the latitude \e lat2; this
|
|
166
|
+
* is added automatically;
|
|
167
|
+
* - \e caps |= GeodesicLineExact::LONGITUDE for the latitude \e lon2;
|
|
168
|
+
* - \e caps |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; this is
|
|
169
|
+
* added automatically;
|
|
170
|
+
* - \e caps |= GeodesicLineExact::DISTANCE for the distance \e s12;
|
|
171
|
+
* - \e caps |= GeodesicLineExact::REDUCEDLENGTH for the reduced length \e
|
|
172
|
+
m12;
|
|
173
|
+
* - \e caps |= GeodesicLineExact::GEODESICSCALE for the geodesic scales \e
|
|
174
|
+
* M12 and \e M21;
|
|
175
|
+
* - \e caps |= GeodesicLineExact::AREA for the area \e S12;
|
|
176
|
+
* - \e caps |= GeodesicLineExact::DISTANCE_IN permits the length of the
|
|
177
|
+
* geodesic to be given in terms of \e s12; without this capability the
|
|
178
|
+
* length can only be specified in terms of arc length;
|
|
179
|
+
* - \e caps |= GeodesicLineExact::ALL for all of the above.
|
|
180
|
+
* .
|
|
181
|
+
* The default value of \e caps is GeodesicLineExact::ALL.
|
|
182
|
+
*
|
|
183
|
+
* If the point is at a pole, the azimuth is defined by keeping \e lon1
|
|
184
|
+
* fixed, writing \e lat1 = ±(90° − ε), and taking
|
|
185
|
+
* the limit ε → 0+.
|
|
186
|
+
**********************************************************************/
|
|
187
|
+
GeodesicLineExact(const GeodesicExact& g, real lat1, real lon1, real azi1,
|
|
188
|
+
unsigned caps = ALL);
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A default constructor. If GeodesicLineExact::Position is called on the
|
|
192
|
+
* resulting object, it returns immediately (without doing any
|
|
193
|
+
* calculations). The object can be set with a call to
|
|
194
|
+
* GeodesicExact::Line. Use Init() to test whether object is still in this
|
|
195
|
+
* uninitialized state.
|
|
196
|
+
**********************************************************************/
|
|
197
|
+
GeodesicLineExact() : _caps(0U) {}
|
|
198
|
+
///@}
|
|
199
|
+
|
|
200
|
+
/** \name Position in terms of distance
|
|
201
|
+
**********************************************************************/
|
|
202
|
+
///@{
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Compute the position of point 2 which is a distance \e s12 (meters)
|
|
206
|
+
* from point 1.
|
|
207
|
+
*
|
|
208
|
+
* @param[in] s12 distance from point 1 to point 2 (meters); it can be
|
|
209
|
+
* signed.
|
|
210
|
+
* @param[out] lat2 latitude of point 2 (degrees).
|
|
211
|
+
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
|
212
|
+
* GeodesicLineExact object was constructed with \e caps |=
|
|
213
|
+
* GeodesicLineExact::LONGITUDE.
|
|
214
|
+
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
|
215
|
+
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
|
216
|
+
* GeodesicLineExact object was constructed with \e caps |=
|
|
217
|
+
* GeodesicLineExact::REDUCEDLENGTH.
|
|
218
|
+
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
|
219
|
+
* (dimensionless); requires that the GeodesicLineExact object was
|
|
220
|
+
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
|
221
|
+
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
|
222
|
+
* (dimensionless); requires that the GeodesicLineExact object was
|
|
223
|
+
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
|
224
|
+
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
|
225
|
+
* that the GeodesicLineExact object was constructed with \e caps |=
|
|
226
|
+
* GeodesicLineExact::AREA.
|
|
227
|
+
* @return \e a12 arc length from point 1 to point 2 (degrees).
|
|
228
|
+
*
|
|
229
|
+
* The values of \e lon2 and \e azi2 returned are in the range
|
|
230
|
+
* [−180°, 180°).
|
|
231
|
+
*
|
|
232
|
+
* The GeodesicLineExact object \e must have been constructed with \e caps
|
|
233
|
+
* |= GeodesicLineExact::DISTANCE_IN; otherwise Math::NaN() is returned and
|
|
234
|
+
* no parameters are set. Requesting a value which the GeodesicLineExact
|
|
235
|
+
* object is not capable of computing is not an error; the corresponding
|
|
236
|
+
* argument will not be altered.
|
|
237
|
+
*
|
|
238
|
+
* The following functions are overloaded versions of
|
|
239
|
+
* GeodesicLineExact::Position which omit some of the output parameters.
|
|
240
|
+
* Note, however, that the arc length is always computed and returned as
|
|
241
|
+
* the function value.
|
|
242
|
+
**********************************************************************/
|
|
243
|
+
Math::real Position(real s12,
|
|
244
|
+
real& lat2, real& lon2, real& azi2,
|
|
245
|
+
real& m12, real& M12, real& M21,
|
|
246
|
+
real& S12) const {
|
|
247
|
+
real t;
|
|
248
|
+
return GenPosition(false, s12,
|
|
249
|
+
LATITUDE | LONGITUDE | AZIMUTH |
|
|
250
|
+
REDUCEDLENGTH | GEODESICSCALE | AREA,
|
|
251
|
+
lat2, lon2, azi2, t, m12, M12, M21, S12);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* See the documentation for GeodesicLineExact::Position.
|
|
256
|
+
**********************************************************************/
|
|
257
|
+
Math::real Position(real s12, real& lat2, real& lon2) const {
|
|
258
|
+
real t;
|
|
259
|
+
return GenPosition(false, s12,
|
|
260
|
+
LATITUDE | LONGITUDE,
|
|
261
|
+
lat2, lon2, t, t, t, t, t, t);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* See the documentation for GeodesicLineExact::Position.
|
|
266
|
+
**********************************************************************/
|
|
267
|
+
Math::real Position(real s12, real& lat2, real& lon2,
|
|
268
|
+
real& azi2) const {
|
|
269
|
+
real t;
|
|
270
|
+
return GenPosition(false, s12,
|
|
271
|
+
LATITUDE | LONGITUDE | AZIMUTH,
|
|
272
|
+
lat2, lon2, azi2, t, t, t, t, t);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* See the documentation for GeodesicLineExact::Position.
|
|
277
|
+
**********************************************************************/
|
|
278
|
+
Math::real Position(real s12, real& lat2, real& lon2,
|
|
279
|
+
real& azi2, real& m12) const {
|
|
280
|
+
real t;
|
|
281
|
+
return GenPosition(false, s12,
|
|
282
|
+
LATITUDE | LONGITUDE |
|
|
283
|
+
AZIMUTH | REDUCEDLENGTH,
|
|
284
|
+
lat2, lon2, azi2, t, m12, t, t, t);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* See the documentation for GeodesicLineExact::Position.
|
|
289
|
+
**********************************************************************/
|
|
290
|
+
Math::real Position(real s12, real& lat2, real& lon2,
|
|
291
|
+
real& azi2, real& M12, real& M21)
|
|
292
|
+
const {
|
|
293
|
+
real t;
|
|
294
|
+
return GenPosition(false, s12,
|
|
295
|
+
LATITUDE | LONGITUDE |
|
|
296
|
+
AZIMUTH | GEODESICSCALE,
|
|
297
|
+
lat2, lon2, azi2, t, t, M12, M21, t);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* See the documentation for GeodesicLineExact::Position.
|
|
302
|
+
**********************************************************************/
|
|
303
|
+
Math::real Position(real s12,
|
|
304
|
+
real& lat2, real& lon2, real& azi2,
|
|
305
|
+
real& m12, real& M12, real& M21)
|
|
306
|
+
const {
|
|
307
|
+
real t;
|
|
308
|
+
return GenPosition(false, s12,
|
|
309
|
+
LATITUDE | LONGITUDE | AZIMUTH |
|
|
310
|
+
REDUCEDLENGTH | GEODESICSCALE,
|
|
311
|
+
lat2, lon2, azi2, t, m12, M12, M21, t);
|
|
312
|
+
}
|
|
313
|
+
///@}
|
|
314
|
+
|
|
315
|
+
/** \name Position in terms of arc length
|
|
316
|
+
**********************************************************************/
|
|
317
|
+
///@{
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Compute the position of point 2 which is an arc length \e a12 (degrees)
|
|
321
|
+
* from point 1.
|
|
322
|
+
*
|
|
323
|
+
* @param[in] a12 arc length from point 1 to point 2 (degrees); it can
|
|
324
|
+
* be signed.
|
|
325
|
+
* @param[out] lat2 latitude of point 2 (degrees).
|
|
326
|
+
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
|
327
|
+
* GeodesicLineExact object was constructed with \e caps |=
|
|
328
|
+
* GeodesicLineExact::LONGITUDE.
|
|
329
|
+
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
|
330
|
+
* @param[out] s12 distance from point 1 to point 2 (meters); requires
|
|
331
|
+
* that the GeodesicLineExact object was constructed with \e caps |=
|
|
332
|
+
* GeodesicLineExact::DISTANCE.
|
|
333
|
+
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
|
334
|
+
* GeodesicLineExact object was constructed with \e caps |=
|
|
335
|
+
* GeodesicLineExact::REDUCEDLENGTH.
|
|
336
|
+
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
|
337
|
+
* (dimensionless); requires that the GeodesicLineExact object was
|
|
338
|
+
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
|
339
|
+
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
|
340
|
+
* (dimensionless); requires that the GeodesicLineExact object was
|
|
341
|
+
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
|
342
|
+
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
|
343
|
+
* that the GeodesicLineExact object was constructed with \e caps |=
|
|
344
|
+
* GeodesicLineExact::AREA.
|
|
345
|
+
*
|
|
346
|
+
* The values of \e lon2 and \e azi2 returned are in the range
|
|
347
|
+
* [−180°, 180°).
|
|
348
|
+
*
|
|
349
|
+
* Requesting a value which the GeodesicLineExact object is not capable of
|
|
350
|
+
* computing is not an error; the corresponding argument will not be
|
|
351
|
+
* altered.
|
|
352
|
+
*
|
|
353
|
+
* The following functions are overloaded versions of
|
|
354
|
+
* GeodesicLineExact::ArcPosition which omit some of the output parameters.
|
|
355
|
+
**********************************************************************/
|
|
356
|
+
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
|
|
357
|
+
real& s12, real& m12, real& M12, real& M21,
|
|
358
|
+
real& S12) const {
|
|
359
|
+
GenPosition(true, a12,
|
|
360
|
+
LATITUDE | LONGITUDE | AZIMUTH | DISTANCE |
|
|
361
|
+
REDUCEDLENGTH | GEODESICSCALE | AREA,
|
|
362
|
+
lat2, lon2, azi2, s12, m12, M12, M21, S12);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* See the documentation for GeodesicLineExact::ArcPosition.
|
|
367
|
+
**********************************************************************/
|
|
368
|
+
void ArcPosition(real a12, real& lat2, real& lon2)
|
|
369
|
+
const {
|
|
370
|
+
real t;
|
|
371
|
+
GenPosition(true, a12,
|
|
372
|
+
LATITUDE | LONGITUDE,
|
|
373
|
+
lat2, lon2, t, t, t, t, t, t);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* See the documentation for GeodesicLineExact::ArcPosition.
|
|
378
|
+
**********************************************************************/
|
|
379
|
+
void ArcPosition(real a12,
|
|
380
|
+
real& lat2, real& lon2, real& azi2)
|
|
381
|
+
const {
|
|
382
|
+
real t;
|
|
383
|
+
GenPosition(true, a12,
|
|
384
|
+
LATITUDE | LONGITUDE | AZIMUTH,
|
|
385
|
+
lat2, lon2, azi2, t, t, t, t, t);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* See the documentation for GeodesicLineExact::ArcPosition.
|
|
390
|
+
**********************************************************************/
|
|
391
|
+
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
|
|
392
|
+
real& s12) const {
|
|
393
|
+
real t;
|
|
394
|
+
GenPosition(true, a12,
|
|
395
|
+
LATITUDE | LONGITUDE | AZIMUTH | DISTANCE,
|
|
396
|
+
lat2, lon2, azi2, s12, t, t, t, t);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* See the documentation for GeodesicLineExact::ArcPosition.
|
|
401
|
+
**********************************************************************/
|
|
402
|
+
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
|
|
403
|
+
real& s12, real& m12) const {
|
|
404
|
+
real t;
|
|
405
|
+
GenPosition(true, a12,
|
|
406
|
+
LATITUDE | LONGITUDE | AZIMUTH |
|
|
407
|
+
DISTANCE | REDUCEDLENGTH,
|
|
408
|
+
lat2, lon2, azi2, s12, m12, t, t, t);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* See the documentation for GeodesicLineExact::ArcPosition.
|
|
413
|
+
**********************************************************************/
|
|
414
|
+
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
|
|
415
|
+
real& s12, real& M12, real& M21)
|
|
416
|
+
const {
|
|
417
|
+
real t;
|
|
418
|
+
GenPosition(true, a12,
|
|
419
|
+
LATITUDE | LONGITUDE | AZIMUTH |
|
|
420
|
+
DISTANCE | GEODESICSCALE,
|
|
421
|
+
lat2, lon2, azi2, s12, t, M12, M21, t);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* See the documentation for GeodesicLineExact::ArcPosition.
|
|
426
|
+
**********************************************************************/
|
|
427
|
+
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2,
|
|
428
|
+
real& s12, real& m12, real& M12, real& M21)
|
|
429
|
+
const {
|
|
430
|
+
real t;
|
|
431
|
+
GenPosition(true, a12,
|
|
432
|
+
LATITUDE | LONGITUDE | AZIMUTH |
|
|
433
|
+
DISTANCE | REDUCEDLENGTH | GEODESICSCALE,
|
|
434
|
+
lat2, lon2, azi2, s12, m12, M12, M21, t);
|
|
435
|
+
}
|
|
436
|
+
///@}
|
|
437
|
+
|
|
438
|
+
/** \name The general position function.
|
|
439
|
+
**********************************************************************/
|
|
440
|
+
///@{
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* The general position function. GeodesicLineExact::Position and
|
|
444
|
+
* GeodesicLineExact::ArcPosition are defined in terms of this function.
|
|
445
|
+
*
|
|
446
|
+
* @param[in] arcmode boolean flag determining the meaning of the second
|
|
447
|
+
* parameter; if \e arcmode is false, then the GeodesicLineExact object
|
|
448
|
+
* must have been constructed with \e caps |=
|
|
449
|
+
* GeodesicLineExact::DISTANCE_IN.
|
|
450
|
+
* @param[in] s12_a12 if \e arcmode is false, this is the distance between
|
|
451
|
+
* point 1 and point 2 (meters); otherwise it is the arc length between
|
|
452
|
+
* point 1 and point 2 (degrees); it can be signed.
|
|
453
|
+
* @param[in] outmask a bitor'ed combination of GeodesicLineExact::mask
|
|
454
|
+
* values specifying which of the following parameters should be set.
|
|
455
|
+
* @param[out] lat2 latitude of point 2 (degrees).
|
|
456
|
+
* @param[out] lon2 longitude of point 2 (degrees); requires that the
|
|
457
|
+
* GeodesicLineExact object was constructed with \e caps |=
|
|
458
|
+
* GeodesicLineExact::LONGITUDE.
|
|
459
|
+
* @param[out] azi2 (forward) azimuth at point 2 (degrees).
|
|
460
|
+
* @param[out] s12 distance from point 1 to point 2 (meters); requires
|
|
461
|
+
* that the GeodesicLineExact object was constructed with \e caps |=
|
|
462
|
+
* GeodesicLineExact::DISTANCE.
|
|
463
|
+
* @param[out] m12 reduced length of geodesic (meters); requires that the
|
|
464
|
+
* GeodesicLineExact object was constructed with \e caps |=
|
|
465
|
+
* GeodesicLineExact::REDUCEDLENGTH.
|
|
466
|
+
* @param[out] M12 geodesic scale of point 2 relative to point 1
|
|
467
|
+
* (dimensionless); requires that the GeodesicLineExact object was
|
|
468
|
+
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
|
469
|
+
* @param[out] M21 geodesic scale of point 1 relative to point 2
|
|
470
|
+
* (dimensionless); requires that the GeodesicLineExact object was
|
|
471
|
+
* constructed with \e caps |= GeodesicLineExact::GEODESICSCALE.
|
|
472
|
+
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requires
|
|
473
|
+
* that the GeodesicLineExact object was constructed with \e caps |=
|
|
474
|
+
* GeodesicLineExact::AREA.
|
|
475
|
+
* @return \e a12 arc length from point 1 to point 2 (degrees).
|
|
476
|
+
*
|
|
477
|
+
* The GeodesicLineExact::mask values possible for \e outmask are
|
|
478
|
+
* - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2;
|
|
479
|
+
* - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon2;
|
|
480
|
+
* - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2;
|
|
481
|
+
* - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12;
|
|
482
|
+
* - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced length
|
|
483
|
+
* \e m12;
|
|
484
|
+
* - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic scales
|
|
485
|
+
* \e M12 and \e M21;
|
|
486
|
+
* - \e outmask |= GeodesicLineExact::AREA for the area \e S12;
|
|
487
|
+
* - \e outmask |= GeodesicLineExact::ALL for all of the above;
|
|
488
|
+
* - \e outmask |= GeodesicLineExact::LONG_UNROLL to unroll \e lon2 instead
|
|
489
|
+
* of wrapping it into the range [−180°, 180°).
|
|
490
|
+
* .
|
|
491
|
+
* Requesting a value which the GeodesicLineExact object is not capable of
|
|
492
|
+
* computing is not an error; the corresponding argument will not be
|
|
493
|
+
* altered. Note, however, that the arc length is always computed and
|
|
494
|
+
* returned as the function value.
|
|
495
|
+
*
|
|
496
|
+
* With the GeodesicLineExact::LONG_UNROLL bit set, the quantity \e lon2
|
|
497
|
+
* − \e lon1 indicates how many times and in what sense the geodesic
|
|
498
|
+
* encircles the ellipsoid.
|
|
499
|
+
**********************************************************************/
|
|
500
|
+
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask,
|
|
501
|
+
real& lat2, real& lon2, real& azi2,
|
|
502
|
+
real& s12, real& m12, real& M12, real& M21,
|
|
503
|
+
real& S12) const;
|
|
504
|
+
///@}
|
|
505
|
+
|
|
506
|
+
/** \name Setting point 3
|
|
507
|
+
**********************************************************************/
|
|
508
|
+
///@{
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Specify position of point 3 in terms of distance.
|
|
512
|
+
*
|
|
513
|
+
* @param[in] s13 the distance from point 1 to point 3 (meters); it
|
|
514
|
+
* can be negative.
|
|
515
|
+
*
|
|
516
|
+
* This is only useful if the GeodesicLineExact object has been constructed
|
|
517
|
+
* with \e caps |= GeodesicLineExact::DISTANCE_IN.
|
|
518
|
+
**********************************************************************/
|
|
519
|
+
void SetDistance(real s13);
|
|
520
|
+
|
|
521
|
+
/**
|
|
522
|
+
* Specify position of point 3 in terms of arc length.
|
|
523
|
+
*
|
|
524
|
+
* @param[in] a13 the arc length from point 1 to point 3 (degrees); it
|
|
525
|
+
* can be negative.
|
|
526
|
+
*
|
|
527
|
+
* The distance \e s13 is only set if the GeodesicLineExact object has been
|
|
528
|
+
* constructed with \e caps |= GeodesicLineExact::DISTANCE.
|
|
529
|
+
**********************************************************************/
|
|
530
|
+
void SetArc(real a13);
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Specify position of point 3 in terms of either distance or arc length.
|
|
534
|
+
*
|
|
535
|
+
* @param[in] arcmode boolean flag determining the meaning of the second
|
|
536
|
+
* parameter; if \e arcmode is false, then the GeodesicLineExact object
|
|
537
|
+
* must have been constructed with \e caps |=
|
|
538
|
+
* GeodesicLineExact::DISTANCE_IN.
|
|
539
|
+
* @param[in] s13_a13 if \e arcmode is false, this is the distance from
|
|
540
|
+
* point 1 to point 3 (meters); otherwise it is the arc length from
|
|
541
|
+
* point 1 to point 3 (degrees); it can be negative.
|
|
542
|
+
**********************************************************************/
|
|
543
|
+
void GenSetDistance(bool arcmode, real s13_a13);
|
|
544
|
+
|
|
545
|
+
/** \name Inspector functions
|
|
546
|
+
**********************************************************************/
|
|
547
|
+
///@{
|
|
548
|
+
|
|
549
|
+
/**
|
|
550
|
+
* @return true if the object has been initialized.
|
|
551
|
+
**********************************************************************/
|
|
552
|
+
bool Init() const { return _caps != 0U; }
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @return \e lat1 the latitude of point 1 (degrees).
|
|
556
|
+
**********************************************************************/
|
|
557
|
+
Math::real Latitude() const
|
|
558
|
+
{ return Init() ? _lat1 : Math::NaN(); }
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* @return \e lon1 the longitude of point 1 (degrees).
|
|
562
|
+
**********************************************************************/
|
|
563
|
+
Math::real Longitude() const
|
|
564
|
+
{ return Init() ? _lon1 : Math::NaN(); }
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
|
|
568
|
+
**********************************************************************/
|
|
569
|
+
Math::real Azimuth() const
|
|
570
|
+
{ return Init() ? _azi1 : Math::NaN(); }
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* The sine and cosine of \e azi1.
|
|
574
|
+
*
|
|
575
|
+
* @param[out] sazi1 the sine of \e azi1.
|
|
576
|
+
* @param[out] cazi1 the cosine of \e azi1.
|
|
577
|
+
**********************************************************************/
|
|
578
|
+
void Azimuth(real& sazi1, real& cazi1) const
|
|
579
|
+
{ if (Init()) { sazi1 = _salp1; cazi1 = _calp1; } }
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
|
+
* @return \e azi0 the azimuth (degrees) of the geodesic line as it crosses
|
|
583
|
+
* the equator in a northward direction.
|
|
584
|
+
*
|
|
585
|
+
* The result lies in [−90°, 90°].
|
|
586
|
+
**********************************************************************/
|
|
587
|
+
Math::real EquatorialAzimuth() const
|
|
588
|
+
{ return Init() ? Math::atan2d(_salp0, _calp0) : Math::NaN(); }
|
|
589
|
+
|
|
590
|
+
/**
|
|
591
|
+
* The sine and cosine of \e azi0.
|
|
592
|
+
*
|
|
593
|
+
* @param[out] sazi0 the sine of \e azi0.
|
|
594
|
+
* @param[out] cazi0 the cosine of \e azi0.
|
|
595
|
+
**********************************************************************/
|
|
596
|
+
void EquatorialAzimuth(real& sazi0, real& cazi0) const
|
|
597
|
+
{ if (Init()) { sazi0 = _salp0; cazi0 = _calp0; } }
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* @return \e a1 the arc length (degrees) between the northward equatorial
|
|
601
|
+
* crossing and point 1.
|
|
602
|
+
*
|
|
603
|
+
* The result lies in (−180°, 180°].
|
|
604
|
+
**********************************************************************/
|
|
605
|
+
Math::real EquatorialArc() const {
|
|
606
|
+
using std::atan2;
|
|
607
|
+
return Init() ? atan2(_ssig1, _csig1) / Math::degree() : Math::NaN();
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* @return \e a the equatorial radius of the ellipsoid (meters). This is
|
|
612
|
+
* the value inherited from the GeodesicExact object used in the
|
|
613
|
+
* constructor.
|
|
614
|
+
**********************************************************************/
|
|
615
|
+
Math::real MajorRadius() const
|
|
616
|
+
{ return Init() ? _a : Math::NaN(); }
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* @return \e f the flattening of the ellipsoid. This is the value
|
|
620
|
+
* inherited from the GeodesicExact object used in the constructor.
|
|
621
|
+
**********************************************************************/
|
|
622
|
+
Math::real Flattening() const
|
|
623
|
+
{ return Init() ? _f : Math::NaN(); }
|
|
624
|
+
|
|
625
|
+
/**
|
|
626
|
+
* @return \e caps the computational capabilities that this object was
|
|
627
|
+
* constructed with. LATITUDE and AZIMUTH are always included.
|
|
628
|
+
**********************************************************************/
|
|
629
|
+
unsigned Capabilities() const { return _caps; }
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Test what capabilities are available.
|
|
633
|
+
*
|
|
634
|
+
* @param[in] testcaps a set of bitor'ed GeodesicLineExact::mask values.
|
|
635
|
+
* @return true if the GeodesicLineExact object has all these capabilities.
|
|
636
|
+
**********************************************************************/
|
|
637
|
+
bool Capabilities(unsigned testcaps) const {
|
|
638
|
+
testcaps &= OUT_ALL;
|
|
639
|
+
return (_caps & testcaps) == testcaps;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* The distance or arc length to point 3.
|
|
644
|
+
*
|
|
645
|
+
* @param[in] arcmode boolean flag determining the meaning of returned
|
|
646
|
+
* value.
|
|
647
|
+
* @return \e s13 if \e arcmode is false; \e a13 if \e arcmode is true.
|
|
648
|
+
**********************************************************************/
|
|
649
|
+
Math::real GenDistance(bool arcmode) const
|
|
650
|
+
{ return Init() ? (arcmode ? _a13 : _s13) : Math::NaN(); }
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* @return \e s13, the distance to point 3 (meters).
|
|
654
|
+
**********************************************************************/
|
|
655
|
+
Math::real Distance() const { return GenDistance(false); }
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* @return \e a13, the arc length to point 3 (degrees).
|
|
659
|
+
**********************************************************************/
|
|
660
|
+
Math::real Arc() const { return GenDistance(true); }
|
|
661
|
+
///@}
|
|
662
|
+
|
|
663
|
+
};
|
|
664
|
+
|
|
665
|
+
} // namespace GeographicLib
|
|
666
|
+
|
|
667
|
+
#endif // GEOGRAPHICLIB_GEODESICLINEEXACT_HPP
|