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

Find a sequence of points on a single rhumb line. More...

#include <Rhumb.hpp>

Public Types

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

Public Member Functions

void GenPosition (real s12, unsigned outmask, real &lat2, real &lon2, real &S12) const
 
void Position (real s12, real &lat2, real &lon2, real &S12) const
 
void Position (real s12, real &lat2, real &lon2) const
 
Inspector functions
Math::real Latitude () const
 
Math::real Longitude () const
 
Math::real Azimuth () const
 
Math::real MajorRadius () const
 
Math::real Flattening () const
 

Private Types

typedef Math::real real
 

Private Member Functions

RhumbLineoperator= (const RhumbLine &)
 
 RhumbLine (const Rhumb &rh, real lat1, real lon1, real azi12, bool exact)
 

Private Attributes

real _azi12
 
real _calp
 
bool _exact
 
real _lat1
 
real _lon1
 
real _mu1
 
real _psi1
 
real _r1
 
const Rhumb_rh
 
real _salp
 

Friends

class Rhumb
 

Detailed Description

Find a sequence of points on a single rhumb line.

RhumbLine facilitates the determination of a series of points on a single rhumb line. The starting point (lat1, lon1) and the azimuth azi12 are specified in the call to Rhumb::Line which returns a RhumbLine object. RhumbLine.Position returns the location of point 2 (and, optionally, the corresponding area, S12) a distance s12 along the rhumb line.

There is no public constructor for this class. (Use Rhumb::Line to create an instance.) The Rhumb object used to create a RhumbLine must stay in scope as long as the RhumbLine.

Example of use:

// Example of using the GeographicLib::RhumbLine class
#include <iostream>
#include <iomanip>
#include <exception>
#include <cmath>
using namespace std;
using namespace GeographicLib;
int main() {
try {
// Print waypoints between JFK and SIN
// Alternatively: const Rhumb& rhumb = Rhumb::WGS84();
double
lat1 = 40.640, lon1 = -73.779, // JFK
lat2 = 1.359, lon2 = 103.989; // SIN
double s12, azi12;
rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12);
const GeographicLib::RhumbLine line = rhumb.Line(lat1, lon1, azi12);
// Alternatively
// const GeographicLib::RhumbLine line = rhumb.Line(lat1, lon1, azi1);
double ds0 = 500e3; // Nominal distance between points = 500 km
int num = int(ceil(s12 / ds0)); // The number of intervals
cout << fixed << setprecision(3);
{
// Use intervals of equal length
double ds = s12 / num;
for (int i = 0; i <= num; ++i) {
double lat, lon;
line.Position(i * ds, lat, lon);
cout << i << " " << lat << " " << lon << "\n";
}
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

Definition at line 437 of file Rhumb.hpp.

Member Typedef Documentation

◆ real

Definition at line 439 of file Rhumb.hpp.

Member Enumeration Documentation

◆ mask

This is a duplication of Rhumb::mask.

Enumerator
NONE 

No output.

LATITUDE 

Calculate latitude lat2.

LONGITUDE 

Calculate longitude lon2.

AZIMUTH 

Calculate azimuth azi12.

DISTANCE 

Calculate distance s12.

AREA 

Calculate area S12.

LONG_UNROLL 

Unroll lon2 in the direct calculation.

ALL 

Calculate everything. (LONG_UNROLL is not included in this mask.)

Definition at line 452 of file Rhumb.hpp.

Constructor & Destructor Documentation

◆ RhumbLine()

GeographicLib::RhumbLine::RhumbLine ( const Rhumb rh,
real  lat1,
real  lon1,
real  azi12,
bool  exact 
)
private

Definition at line 331 of file src/Rhumb.cpp.

Member Function Documentation

◆ Azimuth()

Math::real GeographicLib::RhumbLine::Azimuth ( ) const
inline
Returns
azi12 the azimuth of the rhumb line (degrees).

Definition at line 573 of file Rhumb.hpp.

◆ Flattening()

Math::real GeographicLib::RhumbLine::Flattening ( ) const
inline
Returns
f the flattening of the ellipsoid. This is the value inherited from the Rhumb object used in the constructor.

Definition at line 585 of file Rhumb.hpp.

◆ GenPosition()

void GeographicLib::RhumbLine::GenPosition ( real  s12,
unsigned  outmask,
real lat2,
real lon2,
real S12 
) const

The general position routine. RhumbLine::Position is defined in term so this function.

Parameters
[in]s12distance between point 1 and point 2 (meters); it can be negative.
[in]outmaska bitor'ed combination of RhumbLine::mask values specifying which of the following parameters should be set.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]S12area under the rhumb line (meters2).

The RhumbLine::mask values possible for outmask are

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

If s12 is large enough that the rhumb line crosses a pole, the longitude of point 2 is indeterminate (a NaN is returned for lon2 and S12).

Definition at line 347 of file src/Rhumb.cpp.

◆ Latitude()

Math::real GeographicLib::RhumbLine::Latitude ( ) const
inline
Returns
lat1 the latitude of point 1 (degrees).

Definition at line 563 of file Rhumb.hpp.

◆ Longitude()

Math::real GeographicLib::RhumbLine::Longitude ( ) const
inline
Returns
lon1 the longitude of point 1 (degrees).

Definition at line 568 of file Rhumb.hpp.

◆ MajorRadius()

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

Definition at line 579 of file Rhumb.hpp.

◆ operator=()

RhumbLine& GeographicLib::RhumbLine::operator= ( const RhumbLine )
private

◆ Position() [1/2]

void GeographicLib::RhumbLine::Position ( real  s12,
real lat2,
real lon2,
real S12 
) const
inline

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

Parameters
[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]S12area under the rhumb line (meters2).

The value of lon2 returned is in the range [−180°, 180°].

If s12 is large enough that the rhumb line crosses a pole, the longitude of point 2 is indeterminate (a NaN is returned for lon2 and S12).

Definition at line 512 of file Rhumb.hpp.

◆ Position() [2/2]

void GeographicLib::RhumbLine::Position ( real  s12,
real lat2,
real lon2 
) const
inline

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

Definition at line 520 of file Rhumb.hpp.

Friends And Related Function Documentation

◆ Rhumb

friend class Rhumb
friend

Definition at line 440 of file Rhumb.hpp.

Member Data Documentation

◆ _azi12

real GeographicLib::RhumbLine::_azi12
private

Definition at line 443 of file Rhumb.hpp.

◆ _calp

real GeographicLib::RhumbLine::_calp
private

Definition at line 443 of file Rhumb.hpp.

◆ _exact

bool GeographicLib::RhumbLine::_exact
private

Definition at line 442 of file Rhumb.hpp.

◆ _lat1

real GeographicLib::RhumbLine::_lat1
private

Definition at line 443 of file Rhumb.hpp.

◆ _lon1

real GeographicLib::RhumbLine::_lon1
private

Definition at line 443 of file Rhumb.hpp.

◆ _mu1

real GeographicLib::RhumbLine::_mu1
private

Definition at line 443 of file Rhumb.hpp.

◆ _psi1

real GeographicLib::RhumbLine::_psi1
private

Definition at line 443 of file Rhumb.hpp.

◆ _r1

real GeographicLib::RhumbLine::_r1
private

Definition at line 443 of file Rhumb.hpp.

◆ _rh

const Rhumb& GeographicLib::RhumbLine::_rh
private

Definition at line 441 of file Rhumb.hpp.

◆ _salp

real GeographicLib::RhumbLine::_salp
private

Definition at line 443 of file Rhumb.hpp.


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


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