Loading...
Searching...
No Matches
AzimuthalEquidistant.cpp
Go to the documentation of this file.
/**
* \file AzimuthalEquidistant.cpp
* \brief Implementation for GeographicLib::AzimuthalEquidistant class
*
* Copyright (c) Charles Karney (2009-2020) <karney@alum.mit.edu> and licensed
* under the MIT/X11 License. For more information, see
* https://geographiclib.sourceforge.io/
**********************************************************************/
#include <GeographicLib/AzimuthalEquidistant.hpp>
namespace GeographicLib {
using namespace std;
AzimuthalEquidistant::AzimuthalEquidistant(const Geodesic& earth)
: eps_(real(0.01) * sqrt(numeric_limits<real>::min()))
, _earth(earth) {}
void AzimuthalEquidistant::Forward(real lat0, real lon0, real lat, real lon,
real& x, real& y,
real& azi, real& rk) const {
real sig, s, azi0, m;
sig = _earth.Inverse(lat0, lon0, lat, lon, s, azi0, azi, m);
Math::sincosd(azi0, x, y);
x *= s; y *= s;
rk = !(sig <= eps_) ? m / s : 1;
}
void AzimuthalEquidistant::Reverse(real lat0, real lon0, real x, real y,
real& lat, real& lon,
real& azi, real& rk) const {
real
azi0 = Math::atan2d(x, y),
s = hypot(x, y);
real sig, m;
sig = _earth.Direct(lat0, lon0, azi0, s, lat, lon, azi, m);
rk = !(sig <= eps_) ? m / s : 1;
}
} // 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::Geodesic::Direct
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:394
GeographicLib::Geodesic::Inverse
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:689
GeographicLib::Math::sincosd
static void sincosd(T x, T &sinx, T &cosx)
Definition Math.cpp:101
GeographicLib::Math::atan2d
static T atan2d(T y, T x)
Definition Math.cpp:199
GeographicLib
Namespace for GeographicLib.
Definition Accumulator.cpp:12
std
Definition NearestNeighbor.hpp:806