#pragma once
#include "standardglobe_global.h"
class QVector3D;
///
/// 经纬度坐标
///
struct LonLatPos {
double _lon_deg = 0;
double _lat_deg = 0;
};
///
/// 经纬高坐标系坐标
///
struct STANDARDGLOBE_EXPORT LonLatAltPos {
double _lon_deg = 0;
double _lat_deg = 0;
double _alt_m = 0;
LonLatAltPos(double lon = 0, double lat = 0, double alt = 0);
LonLatAltPos(const LonLatPos& plain_pos);
LonLatPos toLonLatPos() const;
};
///
/// 地心坐标系
///
struct ECEFv3d {
double _x_pos = 0;// 指向0°经度圈与纬度0°交点
double _y_pos = 0;
double _z_pos = 0;
QVector3D getVec3() const;
static ECEFv3d fromVec3(const QVector3D& p);
};
///
/// 东天北坐标系
///
struct ENUv3d {
double _e_pos = 0;
double _n_pos = 0;
double _t_pos = 0;
};
///
/// 极坐标
///
struct PolarPos {
double _dist_m = 0;
double _azimuth_deg = 0;
double _pitch_deg = 0;
};
///
/// 标准球体坐标转换工具
///
class STANDARDGLOBE_EXPORT StandardGlobe
{
private:
///
/// 标准正球体星球直径
///
static double _radius_m;
public:
StandardGlobe();
static ECEFv3d llaToEcef(const LonLatAltPos& v);
static LonLatAltPos ecefToLLA(const ECEFv3d& v);
///
/// 根据LLA坐标获取两点之间的大地线长度和b->t初始方位角,warning:本计算忽视LLA的高度值
///
///
///
///
///
static void getDistanceWithTargetLLA(const LonLatAltPos& base, const LonLatAltPos& target, double& dist, double& azi);
///
/// 根据两点之间的大地线长度和b->t初始方位角,计算目标LLA定位坐标
///
///
///
///
///
static void getTargetLLAWithDistance(const LonLatAltPos& base, double dist, double azi, LonLatAltPos& target);
///
/// 通过LLA坐标,获取目标极坐标
///
///
///
///
static PolarPos getPolarWithLLA(const LonLatAltPos& base, const LonLatAltPos& target);
///
/// 通过极坐标,获取目标LLA坐标
///
///
///
///
static LonLatAltPos getLLAWithPolar(const LonLatAltPos& base, const PolarPos& target);
};