GeographicLib 2.7

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