Updraft  1.0
Open source glider flight visualisation tool.
GeographicLib::GeodesicLine Class Reference

A geodesic line. More...

#include <GeodesicLine.hpp>

List of all members.

Public Types

enum  mask {
  NONE, LATITUDE, LONGITUDE, AZIMUTH,
  DISTANCE, DISTANCE_IN, REDUCEDLENGTH, GEODESICSCALE,
  AREA, ALL
}
 Bit masks for what calculations to do. More...

Public Member Functions

Constructors
 GeodesicLine (const Geodesic &g, real lat1, real lon1, real azi1, unsigned caps=ALL) throw ()
 Constructor for a geodesic line staring at latitude lat1, longitude lon1, and azimuth azi1 (all in degrees).
 GeodesicLine () throw ()
 A default constructor.
Position in terms of distance
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const throw ()
 Compute the position of point 2 which is a distance s12 (meters) from point 1.
Math::real Position (real s12, real &lat2, real &lon2) const throw ()
 See the documentation for GeodesicLine::Position.
Math::real Position (real s12, real &lat2, real &lon2, real &azi2) const throw ()
 See the documentation for GeodesicLine::Position.
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &m12) const throw ()
 See the documentation for GeodesicLine::Position.
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const throw ()
 See the documentation for GeodesicLine::Position.
Math::real Position (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const throw ()
 See the documentation for GeodesicLine::Position.
Position in terms of arc length
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const throw ()
 Compute the position of point 2 which is an arc length a12 (degrees) from point 1.
void ArcPosition (real a12, real &lat2, real &lon2) const throw ()
 See the documentation for GeodesicLine::ArcPosition.
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2) const throw ()
 See the documentation for GeodesicLine::ArcPosition.
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12) const throw ()
 See the documentation for GeodesicLine::ArcPosition.
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const throw ()
 See the documentation for GeodesicLine::ArcPosition.
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const throw ()
 See the documentation for GeodesicLine::ArcPosition.
void ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const throw ()
 See the documentation for GeodesicLine::ArcPosition.
The general position function.
Math::real GenPosition (bool arcmode, real s12_a12, unsigned outmask, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const throw ()
 The general position function.
Inspector functions
bool Init () const throw ()
Math::real Latitude () const throw ()
Math::real Longitude () const throw ()
Math::real Azimuth () const throw ()
Math::real EquatorialAzimuth () const throw ()
Math::real EquatorialArc () const throw ()
Math::real MajorRadius () const throw ()
Math::real Flattening () const throw ()
unsigned Capabilities () const throw ()
bool Capabilities (unsigned testcaps) const throw ()

Private Types

enum  captype {
  CAP_NONE = Geodesic::CAP_NONE, CAP_C1 = Geodesic::CAP_C1, CAP_C1p = Geodesic::CAP_C1p, CAP_C2 = Geodesic::CAP_C2,
  CAP_C3 = Geodesic::CAP_C3, CAP_C4 = Geodesic::CAP_C4, CAP_ALL = Geodesic::CAP_ALL, OUT_ALL = Geodesic::OUT_ALL
}
typedef Math::real real

Private Attributes

real _lat1
real _lon1
real _azi1
real _a
real _f
real _b
real _c2
real _f1
real _salp0
real _calp0
real _k2
real _salp1
real _calp1
real _ssig1
real _csig1
real _stau1
real _ctau1
real _somg1
real _comg1
real _A1m1
real _A2m1
real _A3c
real _B11
real _B21
real _B31
real _A4
real _B41
real _C1a [nC1_+1]
real _C1pa [nC1p_+1]
real _C2a [nC2_+1]
real _C3a [nC3_]
real _C4a [nC4_]
unsigned _caps

Static Private Attributes

static const int nC1_ = Geodesic::nC1_
static const int nC1p_ = Geodesic::nC1p_
static const int nC2_ = Geodesic::nC2_
static const int nC3_ = Geodesic::nC3_
static const int nC4_ = Geodesic::nC4_

Friends

class Geodesic

Detailed Description

A geodesic line.

GeodesicLine facilitates the determination of a series of points on a single geodesic. The starting point (lat1, lon1) and the azimuth azi1 are specified in the constructor. GeodesicLine.Position returns the location of point 2 a distance s12 along the geodesic. Alternatively GeodesicLine.ArcPosition gives the position of point 2 an arc length a12 along the geodesic.

The default copy constructor and assignment operators work with this class. Similarly, a vector can be used to hold GeodesicLine objects.

The calculations are accurate to better than 15 nm (15 nanometers). See Sec. 9 of arXiv:1102.1215v1 for details.

The algorithms are described in

For more information on geodesics see geodesic.

Example of use:

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


Member Typedef Documentation


Member Enumeration Documentation

Enumerator:
CAP_NONE 
CAP_C1 
CAP_C1p 
CAP_C2 
CAP_C3 
CAP_C4 
CAP_ALL 
OUT_ALL 

Bit masks for what calculations to do.

They signify to the GeodesicLine::GeodesicLine constructor and to Geodesic::Line what capabilities should be included in the GeodesicLine object. This is merely a duplication of Geodesic::mask.

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.

ALL 

All capabilities.

Calculate everything.


Constructor & Destructor Documentation

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

Constructor for a geodesic line staring at latitude lat1, longitude lon1, and azimuth azi1 (all in degrees).

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

lat1 should be in the range [-90, 90]; lon1 and azi1 should be in the range [-180, 360].

The GeodesicLine::mask values are

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

If the point is at a pole, the azimuth is defined by keeping the lon1 fixed and writing lat1 = 90 - eps or -90 + eps and taking the limit eps -> 0 from above.

A default constructor.

If GeodesicLine::Position is called on the resulting object, it returns immediately (without doing any calculations). The object can be set with a call to Geodesic::Line. Use Init() to test whether object is still in this uninitialized state.


Member Function Documentation

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2,
real azi2,
real s12,
real m12,
real M12,
real M21,
real S12 
) const throw () [inline]

Compute the position of point 2 which is an arc length a12 (degrees) from point 1.

Parameters:
[in]a12arc length between point 1 and point 2 (degrees); it can be signed.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::DISTANCE.
[out]m12reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]S12area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.

The values of lon2 and azi2 returned are in the range [-180, 180).

Requesting a value which the GeodesicLine object is not capable of computing is not an error; the corresponding argument will not be altered.

The following functions are overloaded versions of GeodesicLine::ArcPosition which omit some of the output parameters.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2,
real azi2 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2,
real azi2,
real s12 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2,
real azi2,
real s12,
real m12 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2,
real azi2,
real s12,
real M12,
real M21 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

void GeographicLib::GeodesicLine::ArcPosition ( real  a12,
real lat2,
real lon2,
real azi2,
real s12,
real m12,
real M12,
real M21 
) const throw () [inline]

See the documentation for GeodesicLine::ArcPosition.

Math::real GeographicLib::GeodesicLine::Azimuth ( ) const throw () [inline]
Returns:
azi1 the azimuth (degrees) of the geodesic line at point 1.
unsigned GeographicLib::GeodesicLine::Capabilities ( ) const throw () [inline]
Returns:
caps the computational capabilities that this object was constructed with. LATITUDE and AZIMUTH are always included.
bool GeographicLib::GeodesicLine::Capabilities ( unsigned  testcaps) const throw () [inline]
Parameters:
[in]testcapsa set of bitor'ed GeodesicLine::mask values.
Returns:
true if the GeodesicLine object has all these capabilities.
Returns:
a1 the arc length (degrees) between the northward equatorial crossing and point 1.
Returns:
azi0 the azimuth (degrees) of the geodesic line as it crosses the equator in a northward direction.
Returns:
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.
Math::real GeographicLib::GeodesicLine::GenPosition ( bool  arcmode,
real  s12_a12,
unsigned  outmask,
real lat2,
real lon2,
real azi2,
real s12,
real m12,
real M12,
real M21,
real S12 
) const throw ()

The general position function.

GeodesicLine::Position and GeodesicLine::ArcPosition are defined in terms of this function.

Parameters:
[in]arcmodeboolean flag determining the meaning of the second parameter; if arcmode is false, then the GeodesicLine object must have been constructed with caps |= GeodesicLine::DISTANCE_IN.
[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 signed.
[in]outmaska bitor'ed combination of GeodesicLine::mask values specifying which of the following parameters should be set.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
[out]azi2(forward) azimuth at point 2 (degrees).
[out]s12distance between point 1 and point 2 (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::DISTANCE.
[out]m12reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]S12area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.
Returns:
a12 arc length of between point 1 and point 2 (degrees).

The GeodesicLine::mask values possible for outmask are

Requesting a value which the GeodesicLine object is not capable of computing is not an error; the corresponding argument will not be altered. Note, however, that the arc length is always computed and returned as the function value.

bool GeographicLib::GeodesicLine::Init ( ) const throw () [inline]
Returns:
true if the object has been initialized.
Returns:
lat1 the latitude of point 1 (degrees).
Returns:
lon1 the longitude of point 1 (degrees).
Returns:
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.
Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real lat2,
real lon2,
real azi2,
real m12,
real M12,
real M21,
real S12 
) const throw () [inline]

Compute the position of point 2 which is a distance s12 (meters) from point 1.

Parameters:
[in]s12distance between point 1 and point 2 (meters); it can be signed.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
[out]azi2(forward) azimuth at point 2 (degrees).
[out]m12reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
[out]M12geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]M21geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
[out]S12area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.
Returns:
a12 arc length of between point 1 and point 2 (degrees).

The values of lon2 and azi2 returned are in the range [-180, 180).

The GeodesicLine object must have been constructed with caps |= GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no parameters are set. Requesting a value which the GeodesicLine object is not capable of computing is not an error; the corresponding argument will not be altered.

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

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real lat2,
real lon2 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real lat2,
real lon2,
real azi2 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real lat2,
real lon2,
real azi2,
real m12 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real lat2,
real lon2,
real azi2,
real M12,
real M21 
) const throw () [inline]

See the documentation for GeodesicLine::Position.

Math::real GeographicLib::GeodesicLine::Position ( real  s12,
real lat2,
real lon2,
real azi2,
real m12,
real M12,
real M21 
) const throw () [inline]

See the documentation for GeodesicLine::Position.


Friends And Related Function Documentation

friend class Geodesic [friend]

Member Data Documentation

const int GeographicLib::GeodesicLine::nC1_ = Geodesic::nC1_ [static, private]
const int GeographicLib::GeodesicLine::nC1p_ = Geodesic::nC1p_ [static, private]
const int GeographicLib::GeodesicLine::nC2_ = Geodesic::nC2_ [static, private]
const int GeographicLib::GeodesicLine::nC3_ = Geodesic::nC3_ [static, private]
const int GeographicLib::GeodesicLine::nC4_ = Geodesic::nC4_ [static, private]

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines