Public Types | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
GeographicLib::Geodesic Class Reference

Geodesic calculations More...

#include <Geodesic.hpp>

Public Types

enum  mask {
  NONE, LATITUDE, LONGITUDE, AZIMUTH,
  DISTANCE, DISTANCE_IN, REDUCEDLENGTH, GEODESICSCALE,
  AREA, LONG_UNROLL, ALL
}
 

Public Member Functions

Constructor
 Geodesic (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
 
Interface to GeodesicLine.
GeodesicLine Line (real lat1, real lon1, real azi1, unsigned caps=ALL) const
 
GeodesicLine InverseLine (real lat1, real lon1, real lat2, real lon2, unsigned caps=ALL) const
 
GeodesicLine DirectLine (real lat1, real lon1, real azi1, real s12, unsigned caps=ALL) const
 
GeodesicLine ArcDirectLine (real lat1, real lon1, real azi1, real a12, unsigned caps=ALL) const
 
GeodesicLine GenDirectLine (real lat1, real lon1, real azi1, bool arcmode, real s12_a12, unsigned caps=ALL) const
 
Inspector functions.
Math::real MajorRadius () const
 
Math::real Flattening () const
 
Math::real EllipsoidArea () const
 

Static Public Member Functions

static const GeodesicWGS84 ()
 

Private Types

enum  captype {
  CAP_NONE = 0U, CAP_C1 = 1U<<0, CAP_C1p = 1U<<1, CAP_C2 = 1U<<2,
  CAP_C3 = 1U<<3, CAP_C4 = 1U<<4, CAP_ALL = 0x1FU, CAP_MASK = CAP_ALL,
  OUT_ALL = 0x7F80U, OUT_MASK = 0xFF80U
}
 
typedef Math::real real
 

Private Member Functions

void A3coeff ()
 
real A3f (real eps) const
 
void C3coeff ()
 
void C3f (real eps, real c[]) const
 
void C4coeff ()
 
void C4f (real k2, real c[]) const
 
real GenInverse (real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &salp1, real &calp1, real &salp2, real &calp2, real &m12, real &M12, real &M21, real &S12) const
 
real InverseStart (real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real lam12, real slam12, real clam12, real &salp1, real &calp1, real &salp2, real &calp2, real &dnm, real Ca[]) const
 
real Lambda12 (real sbet1, real cbet1, real dn1, real sbet2, real cbet2, real dn2, real salp1, real calp1, real slam120, real clam120, real &salp2, real &calp2, real &sig12, real &ssig1, real &csig1, real &ssig2, real &csig2, real &eps, real &domg12, bool diffp, real &dlam12, real Ca[]) const
 
void Lengths (real eps, real sig12, real ssig1, real csig1, real dn1, real ssig2, real csig2, real dn2, real cbet1, real cbet2, unsigned outmask, real &s12s, real &m12a, real &m0, real &M12, real &M21, real Ca[]) const
 

Static Private Member Functions

static real A1m1f (real eps)
 
static real A2m1f (real eps)
 
static real Astroid (real x, real y)
 
static void C1f (real eps, real c[])
 
static void C1pf (real eps, real c[])
 
static void C2f (real eps, real c[])
 
static real SinCosSeries (bool sinp, real sinx, real cosx, const real c[], int n)
 

Private Attributes

real _a
 
real _A3x [nA3x_]
 
real _b
 
real _c2
 
real _C3x [nC3x_]
 
real _C4x [nC4x_]
 
real _e2
 
real _ep2
 
real _etol2
 
real _f
 
real _f1
 
real _n
 
unsigned maxit2_
 
real tiny_
 
real tol0_
 
real tol1_
 
real tol2_
 
real tolb_
 
real xthresh_
 

Static Private Attributes

static const unsigned maxit1_ = 20
 
static const int nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nA3x_ = nA3_
 
static const int nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2
 
static const int nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER
 
static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2
 
static const int nC_ = GEOGRAPHICLIB_GEODESIC_ORDER + 1
 

Friends

class GeodesicLine
 

Detailed Description

Geodesic calculations

The shortest path between two points on a ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points. (The azimuth is the heading measured clockwise from north. azi2 is the "forward" azimuth, i.e., the heading that takes you beyond point 2 not back to point 1.) In the figure below, latitude if labeled φ, longitude λ (with λ12 = λ2 − λ1), and azimuth α.

Given lat1, lon1, azi1, and s12, we can determine lat2, lon2, and azi2. This is the direct geodesic problem and its solution is given by the function Geodesic::Direct. (If s12 is sufficiently large that the geodesic wraps more than halfway around the earth, there will be another geodesic between the points with a smaller s12.)

Given lat1, lon1, lat2, and lon2, we can determine azi1, azi2, and s12. This is the inverse geodesic problem, whose solution is given by Geodesic::Inverse. Usually, the solution to the inverse problem is unique. In cases where there are multiple solutions (all with the same s12, of course), all the solutions can be easily generated once a particular solution is provided.

The standard way of specifying the direct problem is the specify the distance s12 to the second point. However it is sometimes useful instead to specify the arc length a12 (in degrees) on the auxiliary sphere. This is a mathematical construct used in solving the geodesic problems. The solution of the direct problem in this form is provided by Geodesic::ArcDirect. An arc length in excess of 180° indicates that the geodesic is not a shortest path. In addition, the arc length between an equatorial crossing and the next extremum of latitude for a geodesic is 90°.

This class can also calculate several other quantities related to geodesics. These are:

Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and Geodesic::Inverse allow these quantities to be returned. In addition there are general functions Geodesic::GenDirect, and Geodesic::GenInverse which allow an arbitrary set of results to be computed. The quantities m12, M12, M21 which all specify the behavior of nearby geodesics obey addition rules. If points 1, 2, and 3 all lie on a single geodesic, then the following rules hold:

Additional functionality is provided by the GeodesicLine class, which allows a sequence of points along a geodesic to be computed.

The shortest distance returned by the solution of the inverse problem is (obviously) uniquely defined. However, in a few special cases there are multiple azimuths which yield the same shortest distance. Here is a catalog of those cases:

The calculations are accurate to better than 15 nm (15 nanometers) for the WGS84 ellipsoid. See Sec. 9 of arXiv:1102.1215v1 for details. The algorithms used by this class are based on series expansions using the flattening f as a small parameter. These are only accurate for |f| < 0.02; however reasonably accurate results will be obtained for |f| < 0.2. Here is a table of the approximate maximum error (expressed as a distance) for an ellipsoid with the same equatorial radius as the WGS84 ellipsoid and different values of the flattening.

    |f|      error
    0.01     25 nm
    0.02     30 nm
    0.05     10 um
    0.1     1.5 mm
    0.2     300 mm

For very eccentric ellipsoids, use GeodesicExact instead.

The algorithms are described in

For more information on geodesics see geodesic.

Example of use:

// Example of using the GeographicLib::Geodesic class
#include <iostream>
#include <exception>
using namespace std;
using namespace GeographicLib;
int main() {
try {
// Alternatively: const Geodesic& geod = Geodesic::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;
}
}

GeodSolve is a command-line utility providing access to the functionality of Geodesic and GeodesicLine.

Definition at line 172 of file Geodesic.hpp.

Member Typedef Documentation

◆ real

Definition at line 174 of file Geodesic.hpp.

Member Enumeration Documentation

◆ captype

Enumerator
CAP_NONE 
CAP_C1 
CAP_C1p 
CAP_C2 
CAP_C3 
CAP_C4 
CAP_ALL 
CAP_MASK 
OUT_ALL 
OUT_MASK 

Definition at line 194 of file Geodesic.hpp.

◆ mask

Bit masks for what calculations to do. These masks do double duty. They signify to the GeodesicLine::GeodesicLine constructor and to Geodesic::Line what capabilities should be included in the GeodesicLine object. They also specify which results to return in the general routines Geodesic::GenDirect and Geodesic::GenInverse routines. GeodesicLine::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 GeodesicLine 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 GeodesicLine because this is included by default.)

DISTANCE 

Calculate distance s12.

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. (LONG_UNROLL is not included in this mask.)

Definition at line 263 of file Geodesic.hpp.

Constructor & Destructor Documentation

◆ Geodesic()

GeographicLib::Geodesic::Geodesic ( real  a,
real  f 
)

Constructor for a ellipsoid with

Parameters
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
Exceptions
GeographicErrif a or (1 − f) a is not positive.

Definition at line 42 of file src/Geodesic.cpp.

Member Function Documentation

◆ A1m1f()

Math::real GeographicLib::Geodesic::A1m1f ( real  eps)
staticprivate

Definition at line 956 of file src/Geodesic.cpp.

◆ A2m1f()

Math::real GeographicLib::Geodesic::A2m1f ( real  eps)
staticprivate

Definition at line 1201 of file src/Geodesic.cpp.

◆ A3coeff()

void GeographicLib::Geodesic::A3coeff ( )
private

Definition at line 1340 of file src/Geodesic.cpp.

◆ A3f()

Math::real GeographicLib::Geodesic::A3f ( real  eps) const
private

Definition at line 899 of file src/Geodesic.cpp.

◆ ArcDirect() [1/7]

void GeographicLib::Geodesic::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

Solve the direct geodesic problem where the length of the geodesic is specified in terms of arc length.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]a12arc length between point 1 and point 2 (degrees); it can be negative.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area 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 Geodesic::Direct which omit some of the output parameters.

Definition at line 491 of file Geodesic.hpp.

◆ ArcDirect() [2/7]

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

See the documentation for Geodesic::ArcDirect.

Definition at line 504 of file Geodesic.hpp.

◆ ArcDirect() [3/7]

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

See the documentation for Geodesic::ArcDirect.

Definition at line 515 of file Geodesic.hpp.

◆ ArcDirect() [4/7]

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

See the documentation for Geodesic::ArcDirect.

Definition at line 526 of file Geodesic.hpp.

◆ ArcDirect() [5/7]

void GeographicLib::Geodesic::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 Geodesic::ArcDirect.

Definition at line 538 of file Geodesic.hpp.

◆ ArcDirect() [6/7]

void GeographicLib::Geodesic::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 Geodesic::ArcDirect.

Definition at line 551 of file Geodesic.hpp.

◆ ArcDirect() [7/7]

void GeographicLib::Geodesic::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 Geodesic::ArcDirect.

Definition at line 564 of file Geodesic.hpp.

◆ ArcDirectLine()

GeodesicLine GeographicLib::Geodesic::ArcDirectLine ( real  lat1,
real  lon1,
real  azi1,
real  a12,
unsigned  caps = ALL 
) const

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

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]a12arc length between point 1 and point 2 (degrees); it can be negative.
[in]capsbitor'ed combination of Geodesic::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLine::Position.
Returns
a GeodesicLine object.

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

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

Definition at line 154 of file src/Geodesic.cpp.

◆ Astroid()

Math::real GeographicLib::Geodesic::Astroid ( real  x,
real  y 
)
staticprivate

Definition at line 587 of file src/Geodesic.cpp.

◆ C1f()

void GeographicLib::Geodesic::C1f ( real  eps,
real  c[] 
)
staticprivate

Definition at line 989 of file src/Geodesic.cpp.

◆ C1pf()

void GeographicLib::Geodesic::C1pf ( real  eps,
real  c[] 
)
staticprivate

Definition at line 1095 of file src/Geodesic.cpp.

◆ C2f()

void GeographicLib::Geodesic::C2f ( real  eps,
real  c[] 
)
staticprivate

Definition at line 1234 of file src/Geodesic.cpp.

◆ C3coeff()

void GeographicLib::Geodesic::C3coeff ( )
private

Definition at line 1442 of file src/Geodesic.cpp.

◆ C3f()

void GeographicLib::Geodesic::C3f ( real  eps,
real  c[] 
) const
private

Definition at line 904 of file src/Geodesic.cpp.

◆ C4coeff()

void GeographicLib::Geodesic::C4coeff ( )
private

Definition at line 1647 of file src/Geodesic.cpp.

◆ C4f()

void GeographicLib::Geodesic::C4f ( real  k2,
real  c[] 
) const
private

Definition at line 918 of file src/Geodesic.cpp.

◆ Direct() [1/6]

Math::real GeographicLib::Geodesic::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

Solve the direct geodesic problem where the length of the geodesic is specified in terms of distance.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]s12distance between point 1 and point 2 (meters); it can be negative.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area 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 Geodesic::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 379 of file Geodesic.hpp.

◆ Direct() [2/6]

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

See the documentation for Geodesic::Direct.

Definition at line 393 of file Geodesic.hpp.

◆ Direct() [3/6]

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

See the documentation for Geodesic::Direct.

Definition at line 405 of file Geodesic.hpp.

◆ Direct() [4/6]

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

See the documentation for Geodesic::Direct.

Definition at line 417 of file Geodesic.hpp.

◆ Direct() [5/6]

Math::real GeographicLib::Geodesic::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 Geodesic::Direct.

Definition at line 429 of file Geodesic.hpp.

◆ Direct() [6/6]

Math::real GeographicLib::Geodesic::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 Geodesic::Direct.

Definition at line 442 of file Geodesic.hpp.

◆ DirectLine()

GeodesicLine GeographicLib::Geodesic::DirectLine ( real  lat1,
real  lon1,
real  azi1,
real  s12,
unsigned  caps = ALL 
) const

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

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]s12distance between point 1 and point 2 (meters); it can be negative.
[in]capsbitor'ed combination of Geodesic::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLine::Position.
Returns
a GeodesicLine object.

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

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

Definition at line 149 of file src/Geodesic.cpp.

◆ EllipsoidArea()

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

Definition at line 957 of file Geodesic.hpp.

◆ Flattening()

Math::real GeographicLib::Geodesic::Flattening ( ) const
inline
Returns
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 949 of file Geodesic.hpp.

◆ GenDirect()

Math::real GeographicLib::Geodesic::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 problem. Geodesic::Direct and Geodesic::ArcDirect are defined in terms of this function.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]arcmodeboolean flag determining the meaning of the s12_a12.
[in]s12_a12if 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]outmaska bitor'ed combination of Geodesic::mask values specifying which of the following parameters should be set.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).
Returns
a12 arc length of between point 1 and point 2 (degrees).

The Geodesic::mask values possible for outmask are

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

With the Geodesic::LONG_UNROLL bit set, the quantity lon2lon1 indicates how many times and in what sense the geodesic encircles the ellipsoid.

Definition at line 123 of file src/Geodesic.cpp.

◆ GenDirectLine()

GeodesicLine GeographicLib::Geodesic::GenDirectLine ( real  lat1,
real  lon1,
real  azi1,
bool  arcmode,
real  s12_a12,
unsigned  caps = ALL 
) const

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

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]arcmodeboolean flag determining the meaning of the s12_a12.
[in]s12_a12if 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]capsbitor'ed combination of Geodesic::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLine::Position.
Returns
a GeodesicLine object.

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

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

Definition at line 136 of file src/Geodesic.cpp.

◆ GenInverse() [1/2]

Math::real GeographicLib::Geodesic::GenInverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
unsigned  outmask,
real s12,
real salp1,
real calp1,
real salp2,
real calp2,
real m12,
real M12,
real M21,
real S12 
) const
private

Definition at line 159 of file src/Geodesic.cpp.

◆ GenInverse() [2/2]

Math::real GeographicLib::Geodesic::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. Geodesic::Inverse is defined in terms of this function.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[in]outmaska bitor'ed combination of Geodesic::mask values specifying which of the following parameters should be set.
[out]s12distance between point 1 and point 2 (meters).
[out]azi1azimuth at point 1 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area under the geodesic (meters2).
Returns
a12 arc length of between point 1 and point 2 (degrees).

The Geodesic::mask values possible for outmask are

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

Definition at line 493 of file src/Geodesic.cpp.

◆ Inverse() [1/7]

Math::real GeographicLib::Geodesic::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

Solve the inverse geodesic problem.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters).
[out]azi1azimuth at point 1 (degrees).
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters).
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless).
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless).
[out]S12area 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 solution to the inverse problem is found using Newton's method. If this fails to converge (this is very unlikely in geodetic applications but does occur for very eccentric ellipsoids), then the bisection method is used to refine the solution.

The following functions are overloaded versions of Geodesic::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 674 of file Geodesic.hpp.

◆ Inverse() [2/7]

Math::real GeographicLib::Geodesic::Inverse ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
real s12 
) const
inline

See the documentation for Geodesic::Inverse.

Definition at line 686 of file Geodesic.hpp.

◆ Inverse() [3/7]

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

See the documentation for Geodesic::Inverse.

Definition at line 697 of file Geodesic.hpp.

◆ Inverse() [4/7]

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

See the documentation for Geodesic::Inverse.

Definition at line 708 of file Geodesic.hpp.

◆ Inverse() [5/7]

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

See the documentation for Geodesic::Inverse.

Definition at line 720 of file Geodesic.hpp.

◆ Inverse() [6/7]

Math::real GeographicLib::Geodesic::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 Geodesic::Inverse.

Definition at line 732 of file Geodesic.hpp.

◆ Inverse() [7/7]

Math::real GeographicLib::Geodesic::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 Geodesic::Inverse.

Definition at line 744 of file Geodesic.hpp.

◆ InverseLine()

GeodesicLine GeographicLib::Geodesic::InverseLine ( real  lat1,
real  lon1,
real  lat2,
real  lon2,
unsigned  caps = ALL 
) const

Define a GeodesicLine in terms of the inverse geodesic problem.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[in]capsbitor'ed combination of Geodesic::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLine::Position.
Returns
a GeodesicLine object.

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

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

Definition at line 510 of file src/Geodesic.cpp.

◆ InverseStart()

Math::real GeographicLib::Geodesic::InverseStart ( real  sbet1,
real  cbet1,
real  dn1,
real  sbet2,
real  cbet2,
real  dn2,
real  lam12,
real  slam12,
real  clam12,
real salp1,
real calp1,
real salp2,
real calp2,
real dnm,
real  Ca[] 
) const
private

Definition at line 639 of file src/Geodesic.cpp.

◆ Lambda12()

Math::real GeographicLib::Geodesic::Lambda12 ( real  sbet1,
real  cbet1,
real  dn1,
real  sbet2,
real  cbet2,
real  dn2,
real  salp1,
real  calp1,
real  slam120,
real  clam120,
real salp2,
real calp2,
real sig12,
real ssig1,
real csig1,
real ssig2,
real csig2,
real eps,
real domg12,
bool  diffp,
real dlam12,
real  Ca[] 
) const
private

Definition at line 812 of file src/Geodesic.cpp.

◆ Lengths()

void GeographicLib::Geodesic::Lengths ( real  eps,
real  sig12,
real  ssig1,
real  csig1,
real  dn1,
real  ssig2,
real  csig2,
real  dn2,
real  cbet1,
real  cbet2,
unsigned  outmask,
real s12s,
real m12a,
real m0,
real M12,
real M21,
real  Ca[] 
) const
private

Definition at line 525 of file src/Geodesic.cpp.

◆ Line()

GeodesicLine GeographicLib::Geodesic::Line ( real  lat1,
real  lon1,
real  azi1,
unsigned  caps = ALL 
) const

Set up to compute several points on a single geodesic.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi1azimuth at point 1 (degrees).
[in]capsbitor'ed combination of Geodesic::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLine::Position.
Returns
a GeodesicLine object.

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

The Geodesic::mask values are

The default value of caps is Geodesic::ALL.

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 118 of file src/Geodesic.cpp.

◆ MajorRadius()

Math::real GeographicLib::Geodesic::MajorRadius ( ) const
inline
Returns
a the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 943 of file Geodesic.hpp.

◆ SinCosSeries()

Math::real GeographicLib::Geodesic::SinCosSeries ( bool  sinp,
real  sinx,
real  cosx,
const real  c[],
int  n 
)
staticprivate

Definition at line 94 of file src/Geodesic.cpp.

◆ WGS84()

const Geodesic & GeographicLib::Geodesic::WGS84 ( )
static

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

Definition at line 89 of file src/Geodesic.cpp.

Friends And Related Function Documentation

◆ GeodesicLine

friend class GeodesicLine
friend

Definition at line 175 of file Geodesic.hpp.

Member Data Documentation

◆ _a

real GeographicLib::Geodesic::_a
private

Definition at line 211 of file Geodesic.hpp.

◆ _A3x

real GeographicLib::Geodesic::_A3x[nA3x_]
private

Definition at line 212 of file Geodesic.hpp.

◆ _b

real GeographicLib::Geodesic::_b
private

Definition at line 211 of file Geodesic.hpp.

◆ _c2

real GeographicLib::Geodesic::_c2
private

Definition at line 211 of file Geodesic.hpp.

◆ _C3x

real GeographicLib::Geodesic::_C3x[nC3x_]
private

Definition at line 212 of file Geodesic.hpp.

◆ _C4x

real GeographicLib::Geodesic::_C4x[nC4x_]
private

Definition at line 212 of file Geodesic.hpp.

◆ _e2

real GeographicLib::Geodesic::_e2
private

Definition at line 211 of file Geodesic.hpp.

◆ _ep2

real GeographicLib::Geodesic::_ep2
private

Definition at line 211 of file Geodesic.hpp.

◆ _etol2

real GeographicLib::Geodesic::_etol2
private

Definition at line 211 of file Geodesic.hpp.

◆ _f

real GeographicLib::Geodesic::_f
private

Definition at line 211 of file Geodesic.hpp.

◆ _f1

real GeographicLib::Geodesic::_f1
private

Definition at line 211 of file Geodesic.hpp.

◆ _n

real GeographicLib::Geodesic::_n
private

Definition at line 211 of file Geodesic.hpp.

◆ maxit1_

const unsigned GeographicLib::Geodesic::maxit1_ = 20
staticprivate

Definition at line 190 of file Geodesic.hpp.

◆ maxit2_

unsigned GeographicLib::Geodesic::maxit2_
private

Definition at line 191 of file Geodesic.hpp.

◆ nA1_

const int GeographicLib::Geodesic::nA1_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 176 of file Geodesic.hpp.

◆ nA2_

const int GeographicLib::Geodesic::nA2_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 179 of file Geodesic.hpp.

◆ nA3_

const int GeographicLib::Geodesic::nA3_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 181 of file Geodesic.hpp.

◆ nA3x_

const int GeographicLib::Geodesic::nA3x_ = nA3_
staticprivate

Definition at line 182 of file Geodesic.hpp.

◆ nC1_

const int GeographicLib::Geodesic::nC1_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 177 of file Geodesic.hpp.

◆ nC1p_

const int GeographicLib::Geodesic::nC1p_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 178 of file Geodesic.hpp.

◆ nC2_

const int GeographicLib::Geodesic::nC2_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 180 of file Geodesic.hpp.

◆ nC3_

const int GeographicLib::Geodesic::nC3_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 183 of file Geodesic.hpp.

◆ nC3x_

const int GeographicLib::Geodesic::nC3x_ = (nC3_ * (nC3_ - 1)) / 2
staticprivate

Definition at line 184 of file Geodesic.hpp.

◆ nC4_

const int GeographicLib::Geodesic::nC4_ = GEOGRAPHICLIB_GEODESIC_ORDER
staticprivate

Definition at line 185 of file Geodesic.hpp.

◆ nC4x_

const int GeographicLib::Geodesic::nC4x_ = (nC4_ * (nC4_ + 1)) / 2
staticprivate

Definition at line 186 of file Geodesic.hpp.

◆ nC_

const int GeographicLib::Geodesic::nC_ = GEOGRAPHICLIB_GEODESIC_ORDER + 1
staticprivate

Definition at line 189 of file Geodesic.hpp.

◆ tiny_

real GeographicLib::Geodesic::tiny_
private

Definition at line 192 of file Geodesic.hpp.

◆ tol0_

real GeographicLib::Geodesic::tol0_
private

Definition at line 192 of file Geodesic.hpp.

◆ tol1_

real GeographicLib::Geodesic::tol1_
private

Definition at line 192 of file Geodesic.hpp.

◆ tol2_

real GeographicLib::Geodesic::tol2_
private

Definition at line 192 of file Geodesic.hpp.

◆ tolb_

real GeographicLib::Geodesic::tolb_
private

Definition at line 192 of file Geodesic.hpp.

◆ xthresh_

real GeographicLib::Geodesic::xthresh_
private

Definition at line 192 of file Geodesic.hpp.


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


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:46:12