GeographicLib: GeographicLib::GeodesicExact Class Reference

GeographicLib 2.5.2

Loading...
Searching...
No Matches
GeographicLib::GeodesicExact Class Reference

Exact geodesic calculations. More...

`#include <GeographicLib/GeodesicExact.hpp>`

## Public Types
enum | mask { NONE , LATITUDE , LONGITUDE , AZIMUTH , DISTANCE , STANDARD , DISTANCE_IN , REDUCEDLENGTH , GEODESICSCALE , AREA , LONG_UNROLL , ALL }

## Public Member Functions
Constructor
| GeodesicExact (real a, real f)
Direct geodesic problem specified in terms of distance.
Math::real | Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Math::real | Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2) const
Math::real | Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2) const
Math::real | Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12) const
Math::real | Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const
Math::real | Direct (real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const
Direct geodesic problem specified in terms of arc length.
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2) const
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2) const
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12) const
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const
void | ArcDirect (real lat1, real lon1, real azi1, real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const
General version of the direct geodesic solution.
Math::real | GenDirect (real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
Inverse geodesic problem.
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12) const
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &azi1, real &azi2) const
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2) const
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12) const
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &M12, real &M21) const
Math::real | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21) const
General version of inverse geodesic solution.
Math::real | GenInverse (real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Inspector functions.
Math::real | EquatorialRadius () const
Math::real | Flattening () const
Math::real | EllipsoidArea () const

## Static Public Member Functions
static const GeodesicExact & | WGS84 ()

## Friends
class | GeodesicLineExact
class | Geodesic

## Interface to GeodesicLineExact.
typedef GeodesicLineExact | LineClass
GeodesicLineExact | Line (real lat1, real lon1, real azi1, unsigned caps=ALL) const
GeodesicLineExact | InverseLine (real lat1, real lon1, real lat2, real lon2, unsigned caps=ALL) const
GeodesicLineExact | DirectLine (real lat1, real lon1, real azi1, real s12, unsigned caps=ALL) const
GeodesicLineExact | ArcDirectLine (real lat1, real lon1, real azi1, real a12, unsigned caps=ALL) const
GeodesicLineExact | GenDirectLine (real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned caps=ALL) const

## Detailed Description

Exact geodesic calculations.

The equations for geodesics on an ellipsoid can be expressed in terms of incomplete elliptic integrals. The Geodesic class expands these integrals in a series in the flattening f and this provides an accurate solution for f ∈ [-0.01, 0.01]. The GeodesicExact class computes the ellitpic integrals directly and so provides a solution which is valid for all f. However, in practice, its use should be limited to about b/a ∈ [0.01, 100] or f ∈ [−99, 0.99].

For the WGS84 ellipsoid, these classes are 2–3 times slower than the series solution and 2–3 times less accurate (because it's less easy to control round-off errors with the elliptic integral formulation); i.e., the error is about 40 nm (40 nanometers) instead of 15 nm. However the error in the series solution scales as f7 while the error in the elliptic integral solution depends weakly on f. If the quarter meridian distance is 10000 km and the ratio b/a = 1 − f is varied then the approximate maximum error (expressed as a distance) is

          1 - f  error (nm)
          1/128     387
          1/64      345
          1/32      269
          1/16      210
          1/8       115
          1/4        69
          1/2        36
            1        15
            2        25
            4        96
            8       318
           16       985
           32      2352
           64      6008
          128     19024

The area in this classes is computing by finding an accurate approximation to the area integrand using a discrete sine transform fitting N equally spaced points in σ. N chosen to ensure full accuracy for b/a ∈ [0.01, 100] or f ∈ [−99, 0.99].

The algorithms are described in

- C. F. F. Karney, Geodesics on an arbitrary ellipsoid of revolution, J. Geodesy 98, 4:1–14 (2024); DOI: 10.1007/s00190-023-01813-2.

See Geodesics in terms of elliptic integrals for the formulation. See the documentation on the Geodesic class for additional information on the geodesic problems.

Example of use:

// Example of using the GeographicLib::GeodesicExact class
#include <iostream>
#include <exception>
#include <GeographicLib/GeodesicExact.hpp>
#include <GeographicLib/Constants.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
GeodesicExact geod(Constants::WGS84_a(), Constants::WGS84_f());
// Alternatively: const GeodesicExact& geod = GeodesicExact::WGS84();
{
// Sample direct calculation, travelling about NE from JFK
double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi1 = 51;
double lat2, lon2;
geod.Direct(lat1, lon1, azi1, s12, lat2, lon2);
cout << lat2 << " " << lon2 << "\n";
}
{
// Sample inverse calculation, JFK to LHR
double
lat1 = 40.6, lon1 = -73.8, // JFK Airport
lat2 = 51.6, lon2 = -0.5; // LHR Airport
double s12;
geod.Inverse(lat1, lon1, lat2, lon2, s12);
cout << s12 << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}
main
int main(int argc, const char *const argv[])
Definition CartConvert.cpp:28
Constants.hpp
Header for GeographicLib::Constants class.
GeodesicExact.hpp
Header for GeographicLib::GeodesicExact class.
GeographicLib::Constants::WGS84_f
static T WGS84_f()
Definition Constants.hpp:141
GeographicLib::Constants::WGS84_a
static T WGS84_a()
Definition Constants.hpp:135
GeographicLib
Namespace for GeographicLib.
Definition Accumulator.cpp:12
std
Definition NearestNeighbor.hpp:806

GeodSolve is a command-line utility providing access to the functionality of GeodesicExact and GeodesicLineExact (via the -E option).

Definition at line 85 of file GeodesicExact.hpp.

## Member Typedef Documentation

## ◆ LineClass

typedef GeodesicLineExact GeographicLib::GeodesicExact::LineClass

Typedef for the class for computing multiple points on a geodesic.

Definition at line 707 of file GeodesicExact.hpp.

## Member Enumeration Documentation

## ◆ mask

enum GeographicLib::GeodesicExact::mask

Bit masks for what calculations to do. These masks do double duty. They signify to the GeodesicLineExact::GeodesicLineExact constructor and to GeodesicExact::Line what capabilities should be included in the GeodesicLineExact object. They also specify which results to return in the general routines GeodesicExact::GenDirect and GeodesicExact::GenInverse routines. GeodesicLineExact::mask is a duplication of this enum.

Enumerator
NONE | No capabilities, no output.
LATITUDE | Calculate latitude lat2. (It's not necessary to include this as a capability to GeodesicLineExact because this is included by default.)
LONGITUDE | Calculate longitude lon2.
AZIMUTH | Calculate azimuths azi1 and azi2. (It's not necessary to include this as a capability to GeodesicLineExact because this is included by default.)
DISTANCE | Calculate distance s12.
STANDARD | A combination of the common capabilities: GeodesicExact::LATITUDE, GeodesicExact::LONGITUDE, GeodesicExact::AZIMUTH, GeodesicExact::DISTANCE.
DISTANCE_IN | Allow distance s12 to be used as input in the direct geodesic problem.
REDUCEDLENGTH | Calculate reduced length m12.
GEODESICSCALE | Calculate geodesic scales M12 and M21.
AREA | Calculate area S12.
LONG_UNROLL | Unroll lon2 in the direct calculation.
ALL | All capabilities, calculate everything. (GeodesicExact::LONG_UNROLL is not included in this mask.)

Definition at line 163 of file GeodesicExact.hpp.

## Constructor & Destructor Documentation

## ◆ GeodesicExact()

GeographicLib::GeodesicExact::GeodesicExact | ( | real | a,
|  | real | f )

Constructor for an ellipsoid with

Parameters

  [in] | a | equatorial radius (meters).
  [in] | f | flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.

Exceptions

  GeographicErr | if a or (1 − f) a is not positive.

Definition at line 42 of file GeodesicExact.cpp.

References GeographicLib::Math::digits().

## Member Function Documentation

## ◆ Direct() [1/6]

Math::real GeographicLib::GeodesicExact::Direct | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21,
|  | real & | S12 ) const
| inline

Perform the direct geodesic calculation where the length of the geodesic is specified in terms of distance.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | s12 | distance between point 1 and point 2 (meters); it can be signed.
  [out] | lat2 | latitude of point 2 (degrees).
  [out] | lon2 | longitude of point 2 (degrees).
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | m12 | reduced length of geodesic (meters).
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless).
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless).
  [out] | S12 | area under the geodesic (meters2).

Returns
  a12 arc length of between point 1 and point 2 (degrees).

lat1 should be in the range [−90°, 90°]. The values of lon2 and azi2 returned are in the range [−180°, 180°].

If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+. An arc length greater that 180° signifies a geodesic which is not a shortest path. (For a prolate ellipsoid, an additional condition is necessary for a shortest path: the longitudinal extent must not exceed of 180°.)

The following functions are overloaded versions of GeodesicExact::Direct which omit some of the output parameters. Note, however, that the arc length is always computed and returned as the function value.

Definition at line 286 of file GeodesicExact.hpp.

References AREA, AZIMUTH, GenDirect(), GEODESICSCALE, LATITUDE, LONGITUDE, and REDUCEDLENGTH.

## ◆ Direct() [2/6]

Math::real GeographicLib::GeodesicExact::Direct | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | real & | lat2,
|  | real & | lon2 ) const
| inline

See the documentation for GeodesicExact::Direct.

Definition at line 300 of file GeodesicExact.hpp.

References GenDirect(), LATITUDE, and LONGITUDE.

## ◆ Direct() [3/6]

Math::real GeographicLib::GeodesicExact::Direct | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2 ) const
| inline

See the documentation for GeodesicExact::Direct.

Definition at line 312 of file GeodesicExact.hpp.

References AZIMUTH, GenDirect(), LATITUDE, and LONGITUDE.

## ◆ Direct() [4/6]

Math::real GeographicLib::GeodesicExact::Direct | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | m12 ) const
| inline

See the documentation for GeodesicExact::Direct.

Definition at line 324 of file GeodesicExact.hpp.

References AZIMUTH, GenDirect(), LATITUDE, LONGITUDE, and REDUCEDLENGTH.

## ◆ Direct() [5/6]

Math::real GeographicLib::GeodesicExact::Direct | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicExact::Direct.

Definition at line 336 of file GeodesicExact.hpp.

References AZIMUTH, GenDirect(), GEODESICSCALE, LATITUDE, and LONGITUDE.

## ◆ Direct() [6/6]

Math::real GeographicLib::GeodesicExact::Direct | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicExact::Direct.

Definition at line 349 of file GeodesicExact.hpp.

References AZIMUTH, GenDirect(), GEODESICSCALE, LATITUDE, LONGITUDE, and REDUCEDLENGTH.

## ◆ ArcDirect() [1/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21,
|  | real & | S12 ) const
| inline

Perform the direct geodesic calculation where the length of the geodesic is specified in terms of arc length.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | a12 | arc length between point 1 and point 2 (degrees); it can be signed.
  [out] | lat2 | latitude of point 2 (degrees).
  [out] | lon2 | longitude of point 2 (degrees).
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | s12 | distance between point 1 and point 2 (meters).
  [out] | m12 | reduced length of geodesic (meters).
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless).
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless).
  [out] | S12 | area under the geodesic (meters2).

lat1 should be in the range [−90°, 90°]. The values of lon2 and azi2 returned are in the range [−180°, 180°].

If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+. An arc length greater that 180° signifies a geodesic which is not a shortest path. (For a prolate ellipsoid, an additional condition is necessary for a shortest path: the longitudinal extent must not exceed of 180°.)

The following functions are overloaded versions of GeodesicExact::Direct which omit some of the output parameters.

Definition at line 398 of file GeodesicExact.hpp.

References AREA, AZIMUTH, DISTANCE, GenDirect(), GEODESICSCALE, LATITUDE, LONGITUDE, and REDUCEDLENGTH.

## ◆ ArcDirect() [2/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2 ) const
| inline

See the documentation for GeodesicExact::ArcDirect.

Definition at line 411 of file GeodesicExact.hpp.

References GenDirect(), LATITUDE, and LONGITUDE.

## ◆ ArcDirect() [3/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2 ) const
| inline

See the documentation for GeodesicExact::ArcDirect.

Definition at line 422 of file GeodesicExact.hpp.

References AZIMUTH, GenDirect(), LATITUDE, and LONGITUDE.

## ◆ ArcDirect() [4/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12 ) const
| inline

See the documentation for GeodesicExact::ArcDirect.

Definition at line 433 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, GenDirect(), LATITUDE, and LONGITUDE.

## ◆ ArcDirect() [5/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | m12 ) const
| inline

See the documentation for GeodesicExact::ArcDirect.

Definition at line 445 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, GenDirect(), LATITUDE, LONGITUDE, and REDUCEDLENGTH.

## ◆ ArcDirect() [6/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicExact::ArcDirect.

Definition at line 458 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, GenDirect(), GEODESICSCALE, LATITUDE, and LONGITUDE.

## ◆ ArcDirect() [7/7]

void GeographicLib::GeodesicExact::ArcDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicExact::ArcDirect.

Definition at line 471 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, GenDirect(), GEODESICSCALE, LATITUDE, LONGITUDE, and REDUCEDLENGTH.

## ◆ GenDirect()

Math::real GeographicLib::GeodesicExact::GenDirect | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | bool | arcmode,
|  | real | s12_a12,
|  | unsigned | outmask,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21,
|  | real & | S12 ) const

The general direct geodesic calculation. GeodesicExact::Direct and GeodesicExact::ArcDirect are defined in terms of this function.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | arcmode | boolean flag determining the meaning of the second parameter.
  [in] | s12_a12 | if arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be signed.
  [in] | outmask | a bitor'ed combination of GeodesicExact::mask values specifying which of the following parameters should be set.
  [out] | lat2 | latitude of point 2 (degrees).
  [out] | lon2 | longitude of point 2 (degrees).
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | s12 | distance between point 1 and point 2 (meters).
  [out] | m12 | reduced length of geodesic (meters).
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless).
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless).
  [out] | S12 | area under the geodesic (meters2).

Returns
  a12 arc length of between point 1 and point 2 (degrees).

The GeodesicExact::mask values possible for outmask are

- outmask |= GeodesicExact::LATITUDE for the latitude lat2;
- outmask |= GeodesicExact::LONGITUDE for the latitude lon2;
- outmask |= GeodesicExact::AZIMUTH for the latitude azi2;
- outmask |= GeodesicExact::DISTANCE for the distance s12;
- outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length m12;
- outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales M12 and M21;
- outmask |= GeodesicExact::AREA for the area S12;
- outmask |= GeodesicExact::ALL for all of the above;
- outmask |= GeodesicExact::LONG_UNROLL to unroll lon2 instead of wrapping it into the range [−180°, 180°].

The function value a12 is always computed and returned and this equals s12_a12 is arcmode is true. If outmask includes GeodesicExact::DISTANCE and arcmode is false, then s12 = s12_a12. It is not necessary to include GeodesicExact::DISTANCE_IN in outmask; this is automatically included is arcmode is false.

With the GeodesicExact::LONG_UNROLL bit set, the quantity lon2 − lon1 indicates how many times and in what sense the geodesic encircles the ellipsoid.

Definition at line 402 of file GeodesicExact.cpp.

References DISTANCE_IN, and GeodesicLineExact.

Referenced by ArcDirect(), ArcDirect(), ArcDirect(), ArcDirect(), ArcDirect(), ArcDirect(), ArcDirect(), Direct(), Direct(), Direct(), Direct(), Direct(), and Direct().

## ◆ Inverse() [1/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | s12,
|  | real & | azi1,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21,
|  | real & | S12 ) const
| inline

Perform the inverse geodesic calculation.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | lat2 | latitude of point 2 (degrees).
  [in] | lon2 | longitude of point 2 (degrees).
  [out] | s12 | distance between point 1 and point 2 (meters).
  [out] | azi1 | azimuth at point 1 (degrees).
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | m12 | reduced length of geodesic (meters).
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless).
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless).
  [out] | S12 | area under the geodesic (meters2).

Returns
  a12 arc length of between point 1 and point 2 (degrees).

lat1 and lat2 should be in the range [−90°, 90°]. The values of azi1 and azi2 returned are in the range [−180°, 180°].

If either point is at a pole, the azimuth is defined by keeping the longitude fixed, writing lat = ±(90° − ε), and taking the limit ε → 0+.

The following functions are overloaded versions of GeodesicExact::Inverse which omit some of the output parameters. Note, however, that the arc length is always computed and returned as the function value.

Definition at line 577 of file GeodesicExact.hpp.

References AREA, AZIMUTH, DISTANCE, GEODESICSCALE, and REDUCEDLENGTH.

## ◆ Inverse() [2/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | s12 ) const
| inline

See the documentation for GeodesicExact::Inverse.

Definition at line 589 of file GeodesicExact.hpp.

References DISTANCE.

## ◆ Inverse() [3/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | azi1,
|  | real & | azi2 ) const
| inline

See the documentation for GeodesicExact::Inverse.

Definition at line 600 of file GeodesicExact.hpp.

References AZIMUTH.

## ◆ Inverse() [4/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | s12,
|  | real & | azi1,
|  | real & | azi2 ) const
| inline

See the documentation for GeodesicExact::Inverse.

Definition at line 611 of file GeodesicExact.hpp.

References AZIMUTH, and DISTANCE.

## ◆ Inverse() [5/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | s12,
|  | real & | azi1,
|  | real & | azi2,
|  | real & | m12 ) const
| inline

See the documentation for GeodesicExact::Inverse.

Definition at line 623 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, and REDUCEDLENGTH.

## ◆ Inverse() [6/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | s12,
|  | real & | azi1,
|  | real & | azi2,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicExact::Inverse.

Definition at line 635 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, and GEODESICSCALE.

## ◆ Inverse() [7/7]

Math::real GeographicLib::GeodesicExact::Inverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | real & | s12,
|  | real & | azi1,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicExact::Inverse.

Definition at line 647 of file GeodesicExact.hpp.

References AZIMUTH, DISTANCE, GEODESICSCALE, and REDUCEDLENGTH.

## ◆ GenInverse()

Math::real GeographicLib::GeodesicExact::GenInverse | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | unsigned | outmask,
|  | real & | s12,
|  | real & | azi1,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21,
|  | real & | S12 ) const

The general inverse geodesic calculation. GeodesicExact::Inverse is defined in terms of this function.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | lat2 | latitude of point 2 (degrees).
  [in] | lon2 | longitude of point 2 (degrees).
  [in] | outmask | a bitor'ed combination of GeodesicExact::mask values specifying which of the following parameters should be set.
  [out] | s12 | distance between point 1 and point 2 (meters).
  [out] | azi1 | azimuth at point 1 (degrees).
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | m12 | reduced length of geodesic (meters).
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless).
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless).
  [out] | S12 | area under the geodesic (meters2).

Returns
  a12 arc length of between point 1 and point 2 (degrees).

The GeodesicExact::mask values possible for outmask are

- outmask |= GeodesicExact::DISTANCE for the distance s12;
- outmask |= GeodesicExact::AZIMUTH for the latitude azi2;
- outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length m12;
- outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales M12 and M21;
- outmask |= GeodesicExact::AREA for the area S12;
- outmask |= GeodesicExact::ALL for all of the above.

The arc length is always computed and returned as the function value.

Definition at line 797 of file GeodesicExact.cpp.

References GeographicLib::Math::atan2d(), and AZIMUTH.

## ◆ Line()

GeodesicLineExact GeographicLib::GeodesicExact::Line | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | unsigned | caps = ALL ) const

Set up to compute several points on a single geodesic.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | caps | bitor'ed combination of GeodesicExact::mask values specifying the capabilities the GeodesicLineExact object should possess, i.e., which quantities can be returned in calls to GeodesicLineExact::Position.

Returns
  a GeodesicLineExact object.

lat1 should be in the range [−90°, 90°].

The GeodesicExact::mask values are

- caps |= GeodesicExact::LATITUDE for the latitude lat2; this is added automatically;
- caps |= GeodesicExact::LONGITUDE for the latitude lon2;
- caps |= GeodesicExact::AZIMUTH for the azimuth azi2; this is added automatically;
- caps |= GeodesicExact::DISTANCE for the distance s12;
- caps |= GeodesicExact::REDUCEDLENGTH for the reduced length m12;
- caps |= GeodesicExact::GEODESICSCALE for the geodesic scales M12 and M21;
- caps |= GeodesicExact::AREA for the area S12;
- caps |= GeodesicExact::DISTANCE_IN permits the length of the geodesic to be given in terms of s12; without this capability the length can only be specified in terms of arc length;
- caps |= GeodesicExact::ALL for all of the above.

The default value of caps is GeodesicExact::ALL which turns on all the capabilities.

If the point is at a pole, the azimuth is defined by keeping lon1 fixed, writing lat1 = ±(90 − ε), and taking the limit ε → 0+.

Definition at line 397 of file GeodesicExact.cpp.

References GeodesicLineExact.

## ◆ InverseLine()

GeodesicLineExact GeographicLib::GeodesicExact::InverseLine | ( | real | lat1,
|  | real | lon1,
|  | real | lat2,
|  | real | lon2,
|  | unsigned | caps = ALL ) const

Define a GeodesicLineExact in terms of the inverse geodesic problem.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | lat2 | latitude of point 2 (degrees).
  [in] | lon2 | longitude of point 2 (degrees).
  [in] | caps | bitor'ed combination of GeodesicExact::mask values specifying the capabilities the GeodesicLineExact object should possess, i.e., which quantities can be returned in calls to GeodesicLineExact::Position.

Returns
  a GeodesicLineExact object.

This function sets point 3 of the GeodesicLineExact to correspond to point 2 of the inverse geodesic problem.

lat1 and lat2 should be in the range [−90°, 90°].

Definition at line 815 of file GeodesicExact.cpp.

References GeographicLib::Math::atan2d(), DISTANCE, DISTANCE_IN, and GeodesicLineExact.

## ◆ DirectLine()

GeodesicLineExact GeographicLib::GeodesicExact::DirectLine | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | s12,
|  | unsigned | caps = ALL ) const

Define a GeodesicLineExact in terms of the direct geodesic problem specified in terms of distance.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | s12 | distance between point 1 and point 2 (meters); it can be negative.
  [in] | caps | bitor'ed combination of GeodesicExact::mask values specifying the capabilities the GeodesicLineExact object should possess, i.e., which quantities can be returned in calls to GeodesicLineExact::Position.

Returns
  a GeodesicLineExact object.

This function sets point 3 of the GeodesicLineExact to correspond to point 2 of the direct geodesic problem.

lat1 should be in the range [−90°, 90°].

Definition at line 431 of file GeodesicExact.cpp.

References GenDirectLine(), and GeodesicLineExact.

## ◆ ArcDirectLine()

GeodesicLineExact GeographicLib::GeodesicExact::ArcDirectLine | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | real | a12,
|  | unsigned | caps = ALL ) const

Define a GeodesicLineExact in terms of the direct geodesic problem specified in terms of arc length.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | a12 | arc length between point 1 and point 2 (degrees); it can be negative.
  [in] | caps | bitor'ed combination of GeodesicExact::mask values specifying the capabilities the GeodesicLineExact object should possess, i.e., which quantities can be returned in calls to GeodesicLineExact::Position.

Returns
  a GeodesicLineExact object.

This function sets point 3 of the GeodesicLineExact to correspond to point 2 of the direct geodesic problem.

lat1 should be in the range [−90°, 90°].

Definition at line 437 of file GeodesicExact.cpp.

References GenDirectLine(), and GeodesicLineExact.

## ◆ GenDirectLine()

GeodesicLineExact GeographicLib::GeodesicExact::GenDirectLine | ( | real | lat1,
|  | real | lon1,
|  | real | azi1,
|  | bool | arcmode,
|  | real | s12_a12,
|  | unsigned | caps = ALL ) const

Define a GeodesicLineExact in terms of the direct geodesic problem specified in terms of either distance or arc length.

Parameters

  [in] | lat1 | latitude of point 1 (degrees).
  [in] | lon1 | longitude of point 1 (degrees).
  [in] | azi1 | azimuth at point 1 (degrees).
  [in] | arcmode | boolean flag determining the meaning of the s12_a12.
  [in] | s12_a12 | if arcmode is false, this is the distance between point 1 and point 2 (meters); otherwise it is the arc length between point 1 and point 2 (degrees); it can be negative.
  [in] | caps | bitor'ed combination of GeodesicExact::mask values specifying the capabilities the GeodesicLineExact object should possess, i.e., which quantities can be returned in calls to GeodesicLineExact::Position.

Returns
  a GeodesicLineExact object.

This function sets point 3 of the GeodesicLineExact to correspond to point 2 of the direct geodesic problem.

lat1 should be in the range [−90°, 90°].

Definition at line 417 of file GeodesicExact.cpp.

References GeographicLib::Math::AngNormalize(), GeographicLib::Math::AngRound(), DISTANCE_IN, GeodesicLineExact, and GeographicLib::Math::sincosd().

Referenced by ArcDirectLine(), and DirectLine().

## ◆ EquatorialRadius()

Math::real GeographicLib::GeodesicExact::EquatorialRadius | ( |  | ) | const
| inline

Returns
  a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 852 of file GeodesicExact.hpp.

## ◆ Flattening()

Math::real GeographicLib::GeodesicExact::Flattening | ( |  | ) | const
| inline

Returns
  f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 858 of file GeodesicExact.hpp.

## ◆ EllipsoidArea()

Math::real GeographicLib::GeodesicExact::EllipsoidArea | ( |  | ) | const
| inline

Returns
  total area of ellipsoid in meters2. The area of a polygon encircling a pole can be found by adding GeodesicExact::EllipsoidArea()/2 to the sum of S12 for each side of the polygon.

Definition at line 866 of file GeodesicExact.hpp.

References GeographicLib::Math::pi().

## ◆ WGS84()

const GeodesicExact & GeographicLib::GeodesicExact::WGS84 | ( |  | ) |
| static

A global instantiation of GeodesicExact with the parameters for the WGS84 ellipsoid.

Definition at line 391 of file GeodesicExact.cpp.

References GeographicLib::Constants::WGS84_a(), and GeographicLib::Constants::WGS84_f().

## Friends And Related Symbol Documentation

## ◆ GeodesicLineExact

friend class GeodesicLineExact
| friend

Definition at line 88 of file GeodesicExact.hpp.

References GeodesicLineExact.

Referenced by ArcDirectLine(), DirectLine(), GenDirect(), GenDirectLine(), GeodesicLineExact, InverseLine(), and Line().

## ◆ Geodesic

friend class Geodesic
| friend

Definition at line 89 of file GeodesicExact.hpp.

References Geodesic.

Referenced by Geodesic.

The documentation for this class was generated from the following files:

- GeodesicExact.hpp
- GeodesicExact.cpp