GeographicLib 2.1.2
AzimuthalEquidistant.cpp
Go to the documentation of this file.
1/**
2 * \file AzimuthalEquidistant.cpp
3 * \brief Implementation for GeographicLib::AzimuthalEquidistant class
4 *
5 * Copyright (c) Charles Karney (2009-2020) <charles@karney.com> and licensed
6 * under the MIT/X11 License. For more information, see
7 * https://geographiclib.sourceforge.io/
8 **********************************************************************/
9
11
12namespace GeographicLib {
13
14 using namespace std;
15
17 : eps_(real(0.01) * sqrt(numeric_limits<real>::min()))
18 , _earth(earth) {}
19
20 void AzimuthalEquidistant::Forward(real lat0, real lon0, real lat, real lon,
21 real& x, real& y,
22 real& azi, real& rk) const {
23 real sig, s, azi0, m;
24 sig = _earth.Inverse(lat0, lon0, lat, lon, s, azi0, azi, m);
25 Math::sincosd(azi0, x, y);
26 x *= s; y *= s;
27 rk = !(sig <= eps_) ? m / s : 1;
28 }
29
30 void AzimuthalEquidistant::Reverse(real lat0, real lon0, real x, real y,
31 real& lat, real& lon,
32 real& azi, real& rk) const {
33 real
34 azi0 = Math::atan2d(x, y),
35 s = hypot(x, y);
36 real sig, m;
37 sig = _earth.Direct(lat0, lon0, azi0, s, lat, lon, azi, m);
38 rk = !(sig <= eps_) ? m / s : 1;
39 }
40
41} // namespace GeographicLib
Header for GeographicLib::AzimuthalEquidistant class.
AzimuthalEquidistant(const Geodesic &earth=Geodesic::WGS84())
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const
Geodesic calculations
Definition: Geodesic.hpp:172
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Definition: Geodesic.hpp:385
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Definition: Geodesic.hpp:680
static void sincosd(T x, T &sinx, T &cosx)
Definition: Math.cpp:106
static T atan2d(T y, T x)
Definition: Math.cpp:183
Namespace for GeographicLib.
Definition: Accumulator.cpp:12