GeographicLib: GeographicLib::AuxAngle Class Reference (original) (raw)
An accurate representation of angles. More...
#include <[GeographicLib/AuxAngle.hpp](AuxAngle%5F8hpp%5Fsource.html)>
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 () |
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:
#include
#include
#include
int main(int argc, const char* const argv[]) {
try {
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;
}
}
Header for the GeographicLib::AuxAngle class.
int main(int argc, const char *const argv[])
Header for GeographicLib::Utility class.
An accurate representation of angles.
Definition at line 47 of file AuxAngle.hpp.
GeographicLib::AuxAngle::AuxAngle ( real y = 0, real x = 1 ) | inlineexplicit |
---|
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().
◆ 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 |
---|
◆ radians() [1/2]
Math::real GeographicLib::AuxAngle::radians ( ) const | inline |
---|
◆ lam() [1/2]
Math::real GeographicLib::AuxAngle::lam ( ) const | inline |
---|
◆ lamd() [1/2]
Math::real GeographicLib::AuxAngle::lamd ( ) const | inline |
---|
◆ 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 |
---|
◆ 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()
◆ operator+=()
Add an AuxAngle.
Parameters
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.
◆ degrees() [2/2]
AuxAngle GeographicLib::AuxAngle::degrees ( real d) | inlinestatic |
---|
◆ radians() [2/2]
AuxAngle GeographicLib::AuxAngle::radians ( real r) | inlinestatic |
---|
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
Math::real radians() const
Definition at line 209 of file AuxAngle.hpp.
References AuxAngle().
◆ lam() [2/2]
AuxAngle GeographicLib::AuxAngle::lam ( real psi) | inlinestatic |
---|
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
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) | inlinestatic |
---|
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
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 |
---|
The documentation for this class was generated from the following files: