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

An accurate representation of angles. More...

`#include <GeographicLib/AuxAngle.hpp>`

## Public Member Functions

| AuxAngle (real y=0, real x=1)
Math::real | y () const
Math::real | x () const
Math::real & | y ()
Math::real & | x ()
Math::real | degrees () const
Math::real | radians () const
Math::real | lam () const
Math::real | lamd () const
Math::real | tan () const
AuxAngle | normalized () const
void | normalize ()
AuxAngle | copyquadrant (const AuxAngle &p) const
AuxAngle & | operator+= (const AuxAngle &p)

## Static Public Member Functions

static AuxAngle | degrees (real d)
static AuxAngle | radians (real r)
static AuxAngle | lam (real psi)
static AuxAngle | lamd (real psid)
static AuxAngle | NaN ()

## Detailed Description

An accurate representation of angles.

This class is an implementation of the methods described in

- C. F. F. Karney, On auxiliary latitudes, Survey Review 56(395), 165–180 (2024); preprint arXiv:2212.05818.

An angle is represented be the y and x coordinates of a point in the 2d plane. The two coordinates are proportional to the sine and cosine of the angle. This allows angles close to the cardinal points to be represented accurately. It also saves on unnecessary recomputations of trigonometric functions of the angle. Only angles in [−180°, 180°] can be represented. (A possible extension would be to keep count of the number of turns.)

Example of use:

// Example of using the GeographicLib::AuxAngle class.
#include <iostream>
#include <iomanip>
#include <exception>
#include <GeographicLib/Utility.hpp>
#include <GeographicLib/AuxAngle.hpp>
int main(int argc, const char* const argv[]) {
try {
typedef GeographicLib::AuxAngle angle;
// Print table of parametric latitudes for f = 0.5
double f = 0.5;
std::cout << std::fixed << std::setprecision(4);
for (int d = 0; d <= 90; d+=10) {
angle phi(angle::degrees(d)), beta(phi);
beta.y() *= (1 - f);
std::cout << d << " " << beta.degrees() << "\n";
}
}
catch (const std::exception& e) {
std::cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}
AuxAngle.hpp
Header for the GeographicLib::AuxAngle class.
main
int main(int argc, const char *const argv[])
Definition CartConvert.cpp:28
Utility.hpp
Header for GeographicLib::Utility class.
GeographicLib::AuxAngle
An accurate representation of angles.
Definition AuxAngle.hpp:47

Definition at line 47 of file AuxAngle.hpp.

## Constructor & Destructor Documentation

## AuxAngle()

GeographicLib::AuxAngle::AuxAngle | ( | real | y = 0,
|  | real | x = 1 )

inline explicit

The constructor.

Parameters

  [in] | y | the y coordinate.
  [in] | x | the x coordinate.

Note
  the y coordinate is specified first.

Warning
  either x or y can be infinite, but not both.

The defaults (x = 1 and y = 0) are such that

- no arguments gives an angle of 0;
- 1 argument specifies the tangent of the angle.

Definition at line 65 of file AuxAngle.hpp.

Referenced by copyquadrant(), degrees(), lam(), lamd(), NaN(), normalized(), and radians().

## Member Function Documentation

## y() [1/2]

Math::real GeographicLib::AuxAngle::y | ( |  | ) | const

inline

Returns
  the y component. This is the sine of the angle if the AuxAngle has been normalized.

Definition at line 70 of file AuxAngle.hpp.

Referenced by GeographicLib::AuxLatitude::Authalic(), GeographicLib::Ellipsoid::CircleHeight(), GeographicLib::AuxLatitude::Convert(), copyquadrant(), GeographicLib::DAuxLatitude::DConvert(), degrees(), GeographicLib::AuxLatitude::FromAuxiliary(), GeographicLib::AuxLatitude::Geocentric(), normalized(), GeographicLib::AuxLatitude::Parametric(), and GeographicLib::AuxLatitude::Rectifying().

## x() [1/2]

Math::real GeographicLib::AuxAngle::x | ( |  | ) | const

inline

Returns
  the x component. This is the cosine of the angle if the AuxAngle has been normalized.

Definition at line 75 of file AuxAngle.hpp.

Referenced by GeographicLib::AuxLatitude::Authalic(), GeographicLib::Ellipsoid::CircleRadius(), GeographicLib::AuxLatitude::Conformal(), GeographicLib::AuxLatitude::Convert(), copyquadrant(), GeographicLib::DAuxLatitude::DConvert(), degrees(), GeographicLib::AuxLatitude::FromAuxiliary(), GeographicLib::AuxLatitude::Geocentric(), normalized(), operator+=(), GeographicLib::AuxLatitude::Parametric(), and GeographicLib::AuxLatitude::Rectifying().

## y() [2/2]

Math::real & GeographicLib::AuxAngle::y | ( |  | ) |

inline

Returns
  a reference to the y component. This allows this component to be altered.

Definition at line 80 of file AuxAngle.hpp.

## x() [2/2]

Math::real & GeographicLib::AuxAngle::x | ( |  | ) |

inline

Returns
  a reference to the x component. This allows this component to be altered.

Definition at line 85 of file AuxAngle.hpp.

## degrees() [1/2]

Math::real GeographicLib::AuxAngle::degrees | ( |  | ) | const

inline

Returns
  the AuxAngle converted to the conventional angle measured in degrees.

Definition at line 224 of file AuxAngle.hpp.

References GeographicLib::Math::atan2d().

Referenced by GeographicLib::AuxLatitude::Convert(), GeographicLib::Rhumb::GenInverse(), and GeographicLib::RhumbLine::GenPosition().

## radians() [1/2]

Math::real GeographicLib::AuxAngle::radians | ( |  | ) | const

inline

Returns
  the AuxAngle converted to the conventional angle measured in radians.

Definition at line 228 of file AuxAngle.hpp.

Referenced by GeographicLib::AuxLatitude::Convert(), GeographicLib::DAuxLatitude::DConvert(), GeographicLib::DAuxLatitude::DRectifying(), and GeographicLib::Rhumb::GenInverse().

## lam() [1/2]

Math::real GeographicLib::AuxAngle::lam | ( |  | ) | const

inline

Returns
  the lambertian of the AuxAngle.

Note
  the lambertian of an angle χ is lam(χ) = asinh(tan(χ)).

Definition at line 232 of file AuxAngle.hpp.

References tan().

Referenced by GeographicLib::Rhumb::GenInverse().

## lamd() [1/2]

Math::real GeographicLib::AuxAngle::lamd | ( |  | ) | const

inline

Returns
  the lambertian of the AuxAngle in degrees.

Note
  the lambertian of an angle χ is lam(χ) = asinh(tan(χ)).

Definition at line 236 of file AuxAngle.hpp.

References GeographicLib::Math::degree(), and tan().

## tan()

Math::real GeographicLib::AuxAngle::tan | ( |  | ) | const

inline

Returns
  the tangent of the angle.

Definition at line 113 of file AuxAngle.hpp.

Referenced by GeographicLib::AuxLatitude::Authalic(), GeographicLib::AuxLatitude::Conformal(), GeographicLib::DAuxLatitude::DIsometric(), GeographicLib::DAuxLatitude::DParametric(), GeographicLib::DAuxLatitude::DRectifying(), GeographicLib::AuxLatitude::FromAuxiliary(), GeographicLib::Rhumb::GenInverse(), GeographicLib::RhumbLine::GenPosition(), lam(), lamd(), normalized(), operator+=(), and GeographicLib::AuxLatitude::Rectifying().

## normalized()

AuxAngle GeographicLib::AuxAngle::normalized | ( |  | ) | const

Returns
  a new normalized AuxAngle with the point lying on the unit circle and the y and x components are equal to the sine and cosine of the angle.

Definition at line 28 of file AuxAngle.cpp.

References AuxAngle(), NaN(), tan(), x(), and y().

Referenced by GeographicLib::AuxLatitude::Authalic(), GeographicLib::AuxLatitude::Conformal(), GeographicLib::AuxLatitude::Convert(), GeographicLib::DAuxLatitude::DConvert(), and GeographicLib::AuxLatitude::Rectifying().

## normalize()

void GeographicLib::AuxAngle::normalize | ( |  | ) |

inline

Normalize the AuxAngle in place so that the y and x components are equal to the sine and cosine of the angle.

Definition at line 124 of file AuxAngle.hpp.

## copyquadrant()

AuxAngle GeographicLib::AuxAngle::copyquadrant | ( | const AuxAngle & | p | ) | const

Set the quadrant for the AuxAngle.

Parameters

  [in] | p | the AuxAngle from which the quadrant information is taken.

Returns
  the new AuxAngle in the same quadrant as p.

Definition at line 44 of file AuxAngle.cpp.

References AuxAngle(), x(), and y().

Referenced by GeographicLib::AuxLatitude::FromAuxiliary().

## operator+=()

AuxAngle & GeographicLib::AuxAngle::operator+= | ( | const AuxAngle & | p | ) |

Add an AuxAngle.

Parameters

  [in] | p | the AuxAngle to be added.

Returns
  a reference to the new AuxAngle.

The addition is done in place, altering the current AuxAngle.

Warning
  Neither *this nor p should have an infinite component. If necessary, invoke AuxAngle::normalize on these angles first.

Definition at line 48 of file AuxAngle.cpp.

References tan(), and x().

## degrees() [2/2]

AuxAngle GeographicLib::AuxAngle::degrees | ( | real | d | ) |

inline static

Construct and return an AuxAngle specied as an angle in degrees.

Parameters

  [in] | d | the angle measured in degrees.

Returns
  the corresponding AuxAngle.

This allows a new AuxAngle to be initialized as an angle in degrees with

AuxAngle phi(AuxAngle::degrees(d));
GeographicLib::AuxAngle::degrees
Math::real degrees() const
Definition AuxAngle.hpp:224

Definition at line 203 of file AuxAngle.hpp.

References AuxAngle(), GeographicLib::Math::sincosd(), x(), and y().

## radians() [2/2]

AuxAngle GeographicLib::AuxAngle::radians | ( | real | r | ) |

inline static

Construct and return an AuxAngle specied as an angle in radians.

Parameters

  [in] | r | the angle measured in radians.

Returns
  the corresponding AuxAngle.

This allows a new AuxAngle to be initialized as an angle in radians with

AuxAngle phi(AuxAngle::radians(r));
GeographicLib::AuxAngle::radians
Math::real radians() const
Definition AuxAngle.hpp:228

Definition at line 209 of file AuxAngle.hpp.

References AuxAngle().

## lam() [2/2]

AuxAngle GeographicLib::AuxAngle::lam | ( | real | psi | ) |

inline static

Construct and return an AuxAngle specied by the lambertian of the angle.

Parameters

  [in] | psi | the lambertian of the angle.

Returns
  the corresponding AuxAngle.

This allows a new AuxAngle to be initialized given the lambertian with

AuxAngle chi(AuxAngle::lam(psi));
GeographicLib::AuxAngle::lam
Math::real lam() const
Definition AuxAngle.hpp:232

Note
  this sets the angle χ to gd(ψ) = atan(sinh(ψ)).

Definition at line 214 of file AuxAngle.hpp.

References AuxAngle().

## lamd() [2/2]

AuxAngle GeographicLib::AuxAngle::lamd | ( | real | psid | ) |

inline static

Construct and return an AuxAngle specied by the lambertian of the angle in degrees.

Parameters

  [in] | psid | the lambertian of the angle in degrees.

Returns
  the corresponding AuxAngle.

This allows a new AuxAngle to be initialized given the lambertian with

AuxAngle chi(AuxAngle::lamd(psid));
GeographicLib::AuxAngle::lamd
Math::real lamd() const
Definition AuxAngle.hpp:236

Note
  this sets the angle χ to gd(ψ) = atan(sinh(ψ)).

Definition at line 219 of file AuxAngle.hpp.

References AuxAngle(), and GeographicLib::Math::degree().

## NaN()

AuxAngle GeographicLib::AuxAngle::NaN | ( |  | ) |

static

Returns
  a "NaN" AuxAngle.

Definition at line 24 of file AuxAngle.cpp.

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

Referenced by GeographicLib::AuxLatitude::Convert(), GeographicLib::AuxLatitude::FromAuxiliary(), normalized(), and GeographicLib::AuxLatitude::ToAuxiliary().

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

- AuxAngle.hpp
- AuxAngle.cpp