GeographicLib 2.3

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