16 lines
521 B
C++
16 lines
521 B
C++
#include <GeographicLib/Geodesic.hpp>
|
|
#include <cmath>
|
|
#include <tuple>
|
|
#include "global.hpp"
|
|
std::tuple<float, float> get_offset_from_station(double lat, double lon) {
|
|
const GeographicLib::Geodesic &geod = GeographicLib::Geodesic::WGS84();
|
|
|
|
double distance, azi1, azi2;
|
|
geod.Inverse(receiver_lat, receiver_lon, lat, lon, distance, azi1,
|
|
azi2);
|
|
|
|
double azi_rad = azi1 * M_PI / 180.0;
|
|
|
|
|
|
return {static_cast<float>(distance * std::sin(azi_rad)),static_cast<float>(-distance * std::cos(azi_rad))};
|
|
} |