GeographicLib
2.7
Toggle main menu visibility
Loading...
Searching...
No Matches
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) <karney@alum.mit.edu> and licensed
6
* under the MIT/X11 License. For more information, see
7
* https://geographiclib.sourceforge.io/
8
**********************************************************************/
9
10
#include <
GeographicLib/AzimuthalEquidistant.hpp
>
11
12
namespace
GeographicLib
{
13
14
using namespace
std;
15
16
AzimuthalEquidistant::AzimuthalEquidistant
(
const
Geodesic
& earth)
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
AzimuthalEquidistant.hpp
Header for GeographicLib::AzimuthalEquidistant class.
GeographicLib::AzimuthalEquidistant::AzimuthalEquidistant
AzimuthalEquidistant(const Geodesic &earth=Geodesic::WGS84())
Definition
AzimuthalEquidistant.cpp:16
GeographicLib::AzimuthalEquidistant::Forward
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const
Definition
AzimuthalEquidistant.cpp:20
GeographicLib::AzimuthalEquidistant::Reverse
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const
Definition
AzimuthalEquidistant.cpp:30
GeographicLib::Geodesic
Geodesic calculations
Definition
Geodesic.hpp:175
GeographicLib::Math::sincosd
static void sincosd(T x, T &sinx, T &cosx)
Definition
Math.cpp:104
GeographicLib::Math::atan2d
static T atan2d(T y, T x)
Definition
Math.cpp:212
GeographicLib
Namespace for GeographicLib.
Definition
Accumulator.cpp:12
src
AzimuthalEquidistant.cpp
Generated by
1.17.0