GeographicLib: GeographicLib::GeodesicLine Class Reference

GeographicLib 2.5.2

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

A geodesic line. More...

`#include <GeographicLib/GeodesicLine.hpp>`

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

## Public Member Functions
Constructors
| GeodesicLine (const Geodesic &g, real lat1, real lon1, real azi1, unsigned caps=ALL)
| GeodesicLine ()
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
Math::real | Position (real s12, real &lat2, real &lon2) const
Math::real | Position (real s12, real &lat2, real &lon2, real &azi2) const
Math::real | Position (real s12, real &lat2, real &lon2, real &azi2, real &m12) const
Math::real | Position (real s12, real &lat2, real &lon2, real &azi2, real &M12, real &M21) const
Math::real | Position (real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21) const
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
void | ArcPosition (real a12, real &lat2, real &lon2) const
void | ArcPosition (real a12, real &lat2, real &lon2, real &azi2) const
void | ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12) const
void | ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12) const
void | ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &M12, real &M21) const
void | ArcPosition (real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21) const
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
Setting point 3
void | SetDistance (real s13)
void | SetArc (real a13)
void | GenSetDistance (bool arcmode, real s13_a13)
Inspector functions
bool | Init () const
Math::real | Latitude () const
Math::real | Longitude () const
Math::real | Azimuth () const
void | Azimuth (real &sazi1, real &cazi1) const
Math::real | EquatorialAzimuth () const
void | EquatorialAzimuth (real &sazi0, real &cazi0) const
Math::real | EquatorialArc () const
Math::real | EquatorialRadius () const
Math::real | Flattening () const
bool | Exact () const
unsigned | Capabilities () const
bool | Capabilities (unsigned testcaps) const
Math::real | GenDistance (bool arcmode) const
Math::real | Distance () const
Math::real | Arc () const

## 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; alternatively, the Geodesic::Line method can be used to create a GeodesicLine. GeodesicLine.Position returns the location of point 2 a distance s12 along the geodesic. In addition, GeodesicLine.ArcPosition gives the position of point 2 an arc length a12 along the geodesic.

You can register the position of a reference point 3 a distance (arc length), s13 (a13) along the geodesic with the GeodesicLine.SetDistance (GeodesicLine.SetArc) functions. Points a fractional distance along the line can be found by providing, for example, 0.5 * Distance() as an argument to GeodesicLine.Position. The Geodesic::InverseLine or Geodesic::DirectLine methods return GeodesicLine objects with point 3 set to the point 2 of the corresponding geodesic problem. GeodesicLine objects created with the public constructor or with Geodesic::Line have s13 and a13 set to NaNs.

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. With exact = false (the default) in the constructor for the Geodesic object, 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. For very eccentric ellipsoids, set exact = true in the constructor for the Geodesic object; this will delegate the calculations to GeodesicLineExact.

The algorithms are described in

- C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87, 43–55 (2013); DOI: 10.1007/s00190-012-0578-z; addenda: geod-addenda.html.

For more information on geodesics see Geodesics on an ellipsoid of revolution.

Example of use:

// Example of using the GeographicLib::GeodesicLine class
#include <iostream>
#include <iomanip>
#include <exception>
#include <cmath>
#include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/GeodesicLine.hpp>
#include <GeographicLib/Constants.hpp>
using namespace std;
using namespace GeographicLib;
int main() {
try {
// Print waypoints between JFK and SIN
Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
// Alternatively: const Geodesic& geod = Geodesic::WGS84();
double
lat1 = 40.640, lon1 = -73.779, // JFK
lat2 = 1.359, lon2 = 103.989; // SIN
GeodesicLine line = geod.InverseLine(lat1, lon1, lat2, lon2);
double ds0 = 500e3; // Nominal distance between points = 500 km
int num = int(ceil(line.Distance() / ds0)); // The number of intervals
cout << fixed << setprecision(3);
{
// Use intervals of equal length
double ds = line.Distance() / num;
for (int i = 0; i <= num; ++i) {
double lat, lon;
line.Position(i * ds, lat, lon);
cout << i << " " << lat << " " << lon << "\n";
}
}
{
// Slightly faster, use intervals of equal arc length
double da = line.Arc() / num;
for (int i = 0; i <= num; ++i) {
double lat, lon;
line.ArcPosition(i * da, lat, lon);
cout << i << " " << lat << " " << lon << "\n";
}
}
{
// Check that the inspection functions for exact = true return the same
// as for GeodesicLineExact.
Geodesic geoda(6.4e6, 0.5, true);
GeodesicExact geodb(6.4e6, 0.5);
GeodesicLine linea = geoda.InverseLine(lat1, lon1, lat2, lon2);
GeodesicLineExact lineb = geodb.InverseLine(lat1, lon1, lat2, lon2);
if (! (linea.Init() == lineb.Init() &&
linea.Latitude() == lineb.Latitude() &&
linea.Longitude() == lineb.Longitude() &&
linea.Azimuth() == lineb.Azimuth() &&
linea.EquatorialAzimuth() == lineb.EquatorialAzimuth() &&
linea.EquatorialArc() == lineb.EquatorialArc() &&
linea.EquatorialRadius() == lineb.EquatorialRadius() &&
linea.Flattening() == lineb.Flattening() &&
linea.Capabilities() == lineb.Capabilities() &&
linea.Distance() == lineb.Distance() &&
linea.Arc() == lineb.Arc()) )
cerr << "Incompatible results compared to GeodesicLineExact\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.
GeodesicLine.hpp
Header for GeographicLib::GeodesicLine class.
Geodesic.hpp
Header for GeographicLib::Geodesic 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::GeodesicExact
Exact geodesic calculations.
Definition GeodesicExact.hpp:85
GeographicLib::GeodesicLineExact
An exact geodesic line.
Definition GeodesicLineExact.hpp:42
GeographicLib::GeodesicLineExact::Init
bool Init() const
Definition GeodesicLineExact.hpp:562
GeographicLib::GeodesicLineExact::Flattening
Math::real Flattening() const
Definition GeodesicLineExact.hpp:632
GeographicLib::GeodesicLineExact::Longitude
Math::real Longitude() const
Definition GeodesicLineExact.hpp:573
GeographicLib::GeodesicLineExact::Arc
Math::real Arc() const
Definition GeodesicLineExact.hpp:671
GeographicLib::GeodesicLineExact::EquatorialArc
Math::real EquatorialArc() const
Definition GeodesicLineExact.hpp:615
GeographicLib::GeodesicLineExact::Capabilities
unsigned Capabilities() const
Definition GeodesicLineExact.hpp:639
GeographicLib::GeodesicLineExact::Latitude
Math::real Latitude() const
Definition GeodesicLineExact.hpp:567
GeographicLib::GeodesicLineExact::EquatorialAzimuth
Math::real EquatorialAzimuth() const
Definition GeodesicLineExact.hpp:597
GeographicLib::GeodesicLineExact::Azimuth
Math::real Azimuth() const
Definition GeodesicLineExact.hpp:579
GeographicLib::GeodesicLineExact::Distance
Math::real Distance() const
Definition GeodesicLineExact.hpp:665
GeographicLib::GeodesicLineExact::EquatorialRadius
Math::real EquatorialRadius() const
Definition GeodesicLineExact.hpp:625
GeographicLib::GeodesicLine
A geodesic line.
Definition GeodesicLine.hpp:74
GeographicLib::GeodesicLine::Geodesic
friend class Geodesic
Definition GeodesicLine.hpp:77
GeographicLib::GeodesicLine::Init
bool Init() const
Definition GeodesicLine.hpp:605
GeographicLib::GeodesicLine::Capabilities
unsigned Capabilities() const
Definition GeodesicLine.hpp:686
GeographicLib::GeodesicLine::Latitude
Math::real Latitude() const
Definition GeodesicLine.hpp:610
GeographicLib::GeodesicLine::Distance
Math::real Distance() const
Definition GeodesicLine.hpp:712
GeographicLib::GeodesicLine::EquatorialAzimuth
Math::real EquatorialAzimuth() const
Definition GeodesicLine.hpp:640
GeographicLib::GeodesicLine::Azimuth
Math::real Azimuth() const
Definition GeodesicLine.hpp:622
GeographicLib::GeodesicLine::ArcPosition
void ArcPosition(real a12, real &lat2, real &lon2, real &azi2, real &s12, real &m12, real &M12, real &M21, real &S12) const
Definition GeodesicLine.hpp:410
GeographicLib::GeodesicLine::Position
Math::real Position(real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Definition GeodesicLine.hpp:297
GeographicLib::GeodesicLine::Arc
Math::real Arc() const
Definition GeodesicLine.hpp:717
GeographicLib::GeodesicLine::EquatorialRadius
Math::real EquatorialRadius() const
Definition GeodesicLine.hpp:666
GeographicLib::GeodesicLine::Longitude
Math::real Longitude() const
Definition GeodesicLine.hpp:616
GeographicLib::GeodesicLine::EquatorialArc
Math::real EquatorialArc() const
Definition GeodesicLine.hpp:658
GeographicLib::GeodesicLine::Flattening
Math::real Flattening() const
Definition GeodesicLine.hpp:673
GeographicLib::Geodesic
Geodesic calculations
Definition Geodesic.hpp:175
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 Geodesic and GeodesicLine.

Definition at line 74 of file GeodesicLine.hpp.

## Member Typedef Documentation

## ◆ BaseClass

typedef Geodesic GeographicLib::GeodesicLine::BaseClass

Typedef for the base class implementing geodesics.

Definition at line 198 of file GeodesicLine.hpp.

## Member Enumeration Documentation

## ◆ mask

enum GeographicLib::GeodesicLine::mask

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.
STANDARD | A combination of the common capabilities: GeodesicLine::LATITUDE, GeodesicLine::LONGITUDE, GeodesicLine::AZIMUTH, GeodesicLine::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. (GeodesicLine::LONG_UNROLL is not included in this mask.)

Definition at line 126 of file GeodesicLine.hpp.

## Constructor & Destructor Documentation

## ◆ GeodesicLine() [1/2]

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

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

Parameters

  [in] | g | A Geodesic object used to compute the necessary information about the GeodesicLine.
  [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 GeodesicLine::mask values specifying the capabilities the GeodesicLine object should possess, i.e., which quantities can be returned in calls to GeodesicLine::Position.

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

The GeodesicLine::mask values are

- caps |= GeodesicLine::LATITUDE for the latitude lat2; this is added automatically;
- caps |= GeodesicLine::LONGITUDE for the latitude lon2;
- caps |= GeodesicLine::AZIMUTH for the latitude azi2; this is added automatically;
- caps |= GeodesicLine::DISTANCE for the distance s12;
- caps |= GeodesicLine::REDUCEDLENGTH for the reduced length m12;
- caps |= GeodesicLine::GEODESICSCALE for the geodesic scales M12 and M21;
- caps |= GeodesicLine::AREA for the area S12;
- caps |= GeodesicLine::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 |= GeodesicLine::ALL for all of the above.

The default value of caps is GeodesicLine::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 124 of file GeodesicLine.cpp.

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

## ◆ GeodesicLine() [2/2]

GeographicLib::GeodesicLine::GeodesicLine | ( |  | ) |
| inline

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.

Definition at line 251 of file GeodesicLine.hpp.

## Member Function Documentation

## ◆ Position() [1/6]

Math::real GeographicLib::GeodesicLine::Position | ( | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21,
|  | real & | S12 ) const
| inline

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

Parameters

  [in] | s12 | distance from point 1 to point 2 (meters); it can be negative.
  [out] | lat2 | latitude of point 2 (degrees).
  [out] | lon2 | longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | m12 | reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
  [out] | S12 | area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.

Returns
  a12 arc length from point 1 to 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.

Definition at line 297 of file GeodesicLine.hpp.

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

Referenced by main(), and GeographicLib::Gnomonic::Reverse().

## ◆ Position() [2/6]

Math::real GeographicLib::GeodesicLine::Position | ( | real | s12,
|  | real & | lat2,
|  | real & | lon2 ) const
| inline

See the documentation for GeodesicLine::Position.

Definition at line 311 of file GeodesicLine.hpp.

References GenPosition(), LATITUDE, and LONGITUDE.

## ◆ Position() [3/6]

Math::real GeographicLib::GeodesicLine::Position | ( | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2 ) const
| inline

See the documentation for GeodesicLine::Position.

Definition at line 321 of file GeodesicLine.hpp.

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

## ◆ Position() [4/6]

Math::real GeographicLib::GeodesicLine::Position | ( | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | m12 ) const
| inline

See the documentation for GeodesicLine::Position.

Definition at line 332 of file GeodesicLine.hpp.

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

## ◆ Position() [5/6]

Math::real GeographicLib::GeodesicLine::Position | ( | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicLine::Position.

Definition at line 344 of file GeodesicLine.hpp.

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

## ◆ Position() [6/6]

Math::real GeographicLib::GeodesicLine::Position | ( | real | s12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicLine::Position.

Definition at line 357 of file GeodesicLine.hpp.

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

## ◆ ArcPosition() [1/7]

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

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

Parameters

  [in] | a12 | arc length from point 1 to point 2 (degrees); it can be negative.
  [out] | lat2 | latitude of point 2 (degrees).
  [out] | lon2 | longitude of point 2 (degrees); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | s12 | distance from point 1 to point 2 (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::DISTANCE.
  [out] | m12 | reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
  [out] | S12 | area 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.

Definition at line 410 of file GeodesicLine.hpp.

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

## ◆ ArcPosition() [2/7]

void GeographicLib::GeodesicLine::ArcPosition | ( | real | a12,
|  | real & | lat2,
|  | real & | lon2 ) const
| inline

See the documentation for GeodesicLine::ArcPosition.

Definition at line 422 of file GeodesicLine.hpp.

References GenPosition(), LATITUDE, and LONGITUDE.

## ◆ ArcPosition() [3/7]

void GeographicLib::GeodesicLine::ArcPosition | ( | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2 ) const
| inline

See the documentation for GeodesicLine::ArcPosition.

Definition at line 433 of file GeodesicLine.hpp.

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

## ◆ ArcPosition() [4/7]

void GeographicLib::GeodesicLine::ArcPosition | ( | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12 ) const
| inline

See the documentation for GeodesicLine::ArcPosition.

Definition at line 445 of file GeodesicLine.hpp.

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

## ◆ ArcPosition() [5/7]

void GeographicLib::GeodesicLine::ArcPosition | ( | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | m12 ) const
| inline

See the documentation for GeodesicLine::ArcPosition.

Definition at line 456 of file GeodesicLine.hpp.

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

## ◆ ArcPosition() [6/7]

void GeographicLib::GeodesicLine::ArcPosition | ( | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicLine::ArcPosition.

Definition at line 468 of file GeodesicLine.hpp.

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

## ◆ ArcPosition() [7/7]

void GeographicLib::GeodesicLine::ArcPosition | ( | real | a12,
|  | real & | lat2,
|  | real & | lon2,
|  | real & | azi2,
|  | real & | s12,
|  | real & | m12,
|  | real & | M12,
|  | real & | M21 ) const
| inline

See the documentation for GeodesicLine::ArcPosition.

Definition at line 481 of file GeodesicLine.hpp.

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

## ◆ GenPosition()

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

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

Parameters

  [in] | arcmode | boolean 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_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] | outmask | a bitor'ed combination of GeodesicLine::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); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::LONGITUDE.
  [out] | azi2 | (forward) azimuth at point 2 (degrees).
  [out] | s12 | distance from point 1 to point 2 (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::DISTANCE.
  [out] | m12 | reduced length of geodesic (meters); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::REDUCEDLENGTH.
  [out] | M12 | geodesic scale of point 2 relative to point 1 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
  [out] | M21 | geodesic scale of point 1 relative to point 2 (dimensionless); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::GEODESICSCALE.
  [out] | S12 | area under the geodesic (meters2); requires that the GeodesicLine object was constructed with caps |= GeodesicLine::AREA.

Returns
  a12 arc length from point 1 to point 2 (degrees).

The GeodesicLine::mask values possible for outmask are

- outmask |= GeodesicLine::LATITUDE for the latitude lat2;
- outmask |= GeodesicLine::LONGITUDE for the latitude lon2;
- outmask |= GeodesicLine::AZIMUTH for the latitude azi2;
- outmask |= GeodesicLine::DISTANCE for the distance s12;
- outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length m12;
- outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales M12 and M21;
- outmask |= GeodesicLine::AREA for the area S12;
- outmask |= GeodesicLine::ALL for all of the above;
- outmask |= GeodesicLine::LONG_UNROLL to unroll lon2 instead of reducing it into 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. Note, however, that the arc length is always computed and returned as the function value.

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

Definition at line 142 of file GeodesicLine.cpp.

References GeographicLib::Math::AngNormalize(), AREA, GeographicLib::Math::atan2d(), AZIMUTH, GeographicLib::Math::degree(), DISTANCE, DISTANCE_IN, GEODESICSCALE, Init(), LATITUDE, LONG_UNROLL, LONGITUDE, GeographicLib::Math::NaN(), REDUCEDLENGTH, GeographicLib::Math::sincosd(), and GeographicLib::Math::sq().

Referenced by ArcPosition(), ArcPosition(), ArcPosition(), ArcPosition(), ArcPosition(), ArcPosition(), ArcPosition(), GeographicLib::CassiniSoldner::Forward(), main(), Position(), Position(), Position(), Position(), Position(), Position(), SetArc(), and SetDistance().

## ◆ SetDistance()

void GeographicLib::GeodesicLine::SetDistance | ( | real | s13 | ) |

Specify position of point 3 in terms of distance.

Parameters

  [in] | s13 | the distance from point 1 to point 3 (meters); it can be negative.

This is only useful if the GeodesicLine object has been constructed with caps |= GeodesicLine::DISTANCE_IN.

Definition at line 311 of file GeodesicLine.cpp.

References GenPosition().

Referenced by GenSetDistance().

## ◆ SetArc()

void GeographicLib::GeodesicLine::SetArc | ( | real | a13 | ) |

Specify position of point 3 in terms of arc length.

Parameters

  [in] | a13 | the arc length from point 1 to point 3 (degrees); it can be negative.

The distance s13 is only set if the GeodesicLine object has been constructed with caps |= GeodesicLine::DISTANCE.

Definition at line 319 of file GeodesicLine.cpp.

References DISTANCE, GenPosition(), and GeographicLib::Math::NaN().

Referenced by GenSetDistance().

## ◆ GenSetDistance()

void GeographicLib::GeodesicLine::GenSetDistance | ( | bool | arcmode,
|  | real | s13_a13 )

Specify position of point 3 in terms of either distance or arc length.

Parameters

  [in] | arcmode | boolean 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] | s13_a13 | if arcmode is false, this is the distance from point 1 to point 3 (meters); otherwise it is the arc length from point 1 to point 3 (degrees); it can be negative.

Definition at line 327 of file GeodesicLine.cpp.

References SetArc(), and SetDistance().

## ◆ Init()

bool GeographicLib::GeodesicLine::Init | ( |  | ) | const
| inline

Returns
  true if the object has been initialized.

Definition at line 605 of file GeodesicLine.hpp.

Referenced by Azimuth(), Azimuth(), EquatorialArc(), EquatorialAzimuth(), EquatorialAzimuth(), EquatorialRadius(), Flattening(), GenDistance(), GenPosition(), Latitude(), and Longitude().

## ◆ Latitude()

Math::real GeographicLib::GeodesicLine::Latitude | ( |  | ) | const
| inline

Returns
  lat1 the latitude of point 1 (degrees).

Definition at line 610 of file GeodesicLine.hpp.

References Init(), and GeographicLib::Math::NaN().

## ◆ Longitude()

Math::real GeographicLib::GeodesicLine::Longitude | ( |  | ) | const
| inline

Returns
  lon1 the longitude of point 1 (degrees).

Definition at line 616 of file GeodesicLine.hpp.

References Init(), and GeographicLib::Math::NaN().

## ◆ Azimuth() [1/2]

Math::real GeographicLib::GeodesicLine::Azimuth | ( |  | ) | const
| inline

Returns
  azi1 the azimuth (degrees) of the geodesic line at point 1.

Definition at line 622 of file GeodesicLine.hpp.

References Init(), and GeographicLib::Math::NaN().

Referenced by main().

## ◆ Azimuth() [2/2]

void GeographicLib::GeodesicLine::Azimuth | ( | real & | sazi1,
|  | real & | cazi1 ) const
| inline

The sine and cosine of azi1.

Parameters

  [out] | sazi1 | the sine of azi1.
  [out] | cazi1 | the cosine of azi1.

Definition at line 631 of file GeodesicLine.hpp.

References Init().

## ◆ EquatorialAzimuth() [1/2]

Math::real GeographicLib::GeodesicLine::EquatorialAzimuth | ( |  | ) | const
| inline

Returns
  azi0 the azimuth (degrees) of the geodesic line as it crosses the equator in a northward direction.

The result lies in [−90°, 90°].

Definition at line 640 of file GeodesicLine.hpp.

References GeographicLib::Math::atan2d(), Init(), and GeographicLib::Math::NaN().

Referenced by GeographicLib::CassiniSoldner::Forward().

## ◆ EquatorialAzimuth() [2/2]

void GeographicLib::GeodesicLine::EquatorialAzimuth | ( | real & | sazi0,
|  | real & | cazi0 ) const
| inline

The sine and cosine of azi0.

Parameters

  [out] | sazi0 | the sine of azi0.
  [out] | cazi0 | the cosine of azi0.

Definition at line 649 of file GeodesicLine.hpp.

References Init().

## ◆ EquatorialArc()

Math::real GeographicLib::GeodesicLine::EquatorialArc | ( |  | ) | const
| inline

Returns
  a1 the arc length (degrees) between the northward equatorial crossing and point 1.

The result lies in [−180°, 180°].

Definition at line 658 of file GeodesicLine.hpp.

References GeographicLib::Math::atan2d(), Init(), and GeographicLib::Math::NaN().

## ◆ EquatorialRadius()

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

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

Definition at line 666 of file GeodesicLine.hpp.

References Init(), and GeographicLib::Math::NaN().

## ◆ Flattening()

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

Returns
  f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 673 of file GeodesicLine.hpp.

References Init(), and GeographicLib::Math::NaN().

## ◆ Exact()

bool GeographicLib::GeodesicLine::Exact | ( |  | ) | const
| inline

Returns
  exact whether the exact formulation is used. This is the value returned by the Geodesic object used in the constructor.

Definition at line 680 of file GeodesicLine.hpp.

## ◆ Capabilities() [1/2]

unsigned GeographicLib::GeodesicLine::Capabilities | ( |  | ) | const
| inline

Returns
  caps the computational capabilities that this object was constructed with. LATITUDE and AZIMUTH are always included.

Definition at line 686 of file GeodesicLine.hpp.

## ◆ Capabilities() [2/2]

bool GeographicLib::GeodesicLine::Capabilities | ( | unsigned | testcaps | ) | const
| inline

Test what capabilities are available.

Parameters

  [in] | testcaps | a set of bitor'ed GeodesicLine::mask values.

Returns
  true if the GeodesicLine object has all these capabilities.

Definition at line 694 of file GeodesicLine.hpp.

## ◆ GenDistance()

Math::real GeographicLib::GeodesicLine::GenDistance | ( | bool | arcmode | ) | const
| inline

The distance or arc length to point 3.

Parameters

  [in] | arcmode | boolean flag determining the meaning of returned value.

Returns
  s13 if arcmode is false; a13 if arcmode is true.

Definition at line 706 of file GeodesicLine.hpp.

References Init(), and GeographicLib::Math::NaN().

Referenced by Arc(), Distance(), and main().

## ◆ Distance()

Math::real GeographicLib::GeodesicLine::Distance | ( |  | ) | const
| inline

Returns
  s13, the distance to point 3 (meters).

Definition at line 712 of file GeodesicLine.hpp.

References GenDistance().

Referenced by main().

## ◆ Arc()

Math::real GeographicLib::GeodesicLine::Arc | ( |  | ) | const
| inline

Returns
  a13, the arc length to point 3 (degrees).

Definition at line 717 of file GeodesicLine.hpp.

References GenDistance().

## Friends And Related Symbol Documentation

## ◆ Geodesic

friend class Geodesic
| friend

Definition at line 77 of file GeodesicLine.hpp.

References Geodesic.

Referenced by Geodesic, and GeodesicLine().

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

- GeodesicLine.hpp
- GeodesicLine.cpp