改进工程代码分布
This commit is contained in:
parent
f2148707b7
commit
73dc83d8f3
|
@ -37,7 +37,7 @@
|
|||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core</QtModules>
|
||||
<QtModules>core;gui</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||
|
@ -60,7 +60,7 @@
|
|||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<IncludePath>$(SolutionDir)SimsBasic;$(SolutionDir)MessageBasic;$(IncludePath)</IncludePath>
|
||||
<IncludePath>$(SolutionDir)SimsBasic;$(SolutionDir)MessageBasic;$(SolutionDir)StandardGlobe;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(SolutionDir)$(Platform)\$(Configuration);$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core</QtModules>
|
||||
<QtModules>core;gui</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "messagebasic_global.h"
|
||||
#include "simsbasic.h"
|
||||
#include "standardglobe.h"
|
||||
#include <simsbasic.h>
|
||||
#include <standardglobe.h>
|
||||
|
||||
#define NAME(v) #v
|
||||
#define DOUBLE_SAVE(u) obj[NAME(u)] = u
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="QtSettings">
|
||||
<QtInstall>5.12.11_msvc2017_64</QtInstall>
|
||||
<QtModules>core;3dcore;3danimation;3dextras;3dinput;3dlogic;3drender</QtModules>
|
||||
<QtModules>core;gui</QtModules>
|
||||
<QtBuildConfig>debug</QtBuildConfig>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'" Label="QtSettings">
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "standardglobe.h"
|
||||
#include <cmath>
|
||||
#include <QVector3D>
|
||||
|
||||
double StandardGlobe::_radius_m = 65000000;
|
||||
#define PI 3.14159265354
|
||||
|
@ -95,7 +96,70 @@ void StandardGlobe::getTargetLLAWithDistance(const LLAPos& base, double dist, do
|
|||
target = ecefToLLA(sv);
|
||||
}
|
||||
|
||||
PolarPos StandardGlobe::getPolarWithLLA(const LLAPos& base, const LLAPos& target)
|
||||
{
|
||||
// ecef文楚
|
||||
auto vec_base = llaToEcef(base).getVec3();
|
||||
auto vec_target = llaToEcef(target).getVec3();
|
||||
auto vec_bn = vec_base.normalized();
|
||||
auto vec_tn = vec_target.normalized();
|
||||
|
||||
// 朕炎峠中隈<E4B8AD>文楚
|
||||
auto vec_vn = QVector3D::crossProduct(vec_bn, vec_tn).normalized();
|
||||
// 朕炎峠中俳<E4B8AD>文楚
|
||||
auto vec_hn = QVector3D::crossProduct(vec_vn, vec_bn).normalized();
|
||||
|
||||
// 兜兵圭了叔cos峙
|
||||
auto cos_angle = QVector3D::dotProduct(vec_hn, QVector3D(0, 0, 1));
|
||||
auto angle = acos(cos_angle);
|
||||
|
||||
// 180<丕刮
|
||||
auto flag_vec = QVector3D::crossProduct(vec_hn, QVector3D(0, 0, 1)).normalized();
|
||||
if (vec_bn.z() * flag_vec.z() < 0)
|
||||
angle = 2 * PI - angle;
|
||||
|
||||
// 卦指圭了叔
|
||||
auto azi_deg = rad2d(angle);
|
||||
|
||||
// 篇<>文楚
|
||||
auto vec_bt = vec_target - vec_base;
|
||||
auto vec_btn = vec_bt.normalized();
|
||||
auto cos_pitch = QVector3D::dotProduct(vec_hn, vec_btn);
|
||||
auto pit_deg = rad2d(acos(cos_pitch));
|
||||
|
||||
PolarPos p;
|
||||
p._azimuth_deg = azi_deg;
|
||||
p._pitch_deg = pit_deg;
|
||||
p._dist_m = vec_bt.length();
|
||||
return p;
|
||||
}
|
||||
|
||||
LLAPos StandardGlobe::getLLAWithPolar(const LLAPos& base, const PolarPos& target)
|
||||
{
|
||||
auto ecef_b = llaToEcef(base).getVec3();
|
||||
auto u_azi = QQuaternion(-deg2a(target._azimuth_deg), ecef_b.normalized());
|
||||
|
||||
auto vec_ts = u_azi.rotatedVector(QVector3D(0,0,1)).normalized();
|
||||
auto axis_pitch = QVector3D::crossProduct(vec_ts, ecef_b.normalized());
|
||||
auto u_pit = QQuaternion(deg2a(target._pitch_deg), axis_pitch);
|
||||
|
||||
auto r_shadow = target._dist_m * cos(deg2a(target._pitch_deg));
|
||||
auto ts_appv = u_pit.rotatedVector(vec_ts).normalized() * r_shadow;
|
||||
|
||||
auto ecef_target = ecef_b + ts_appv;
|
||||
ECEFPos tt = ECEFPos::fromVec3(ecef_target);
|
||||
|
||||
return ecefToLLA(tt);
|
||||
}
|
||||
|
||||
QVector3D ECEFPos::getVec3() const
|
||||
{
|
||||
return QVector3D(_x_pos, _y_pos, _z_pos);
|
||||
}
|
||||
ECEFPos ECEFPos::fromVec3(const QVector3D& p) {
|
||||
ECEFPos o;
|
||||
o._x_pos = p.x();
|
||||
o._y_pos = p.y();
|
||||
o._z_pos = p.z();
|
||||
return o;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "standardglobe_global.h"
|
||||
#include <qvector3d.h>
|
||||
|
||||
class QVector3D;
|
||||
|
||||
/// <summary>
|
||||
/// 经纬高坐标系坐标
|
||||
|
@ -16,10 +17,11 @@ struct LLAPos {
|
|||
/// 地心坐标系
|
||||
/// </summary>
|
||||
struct ECEFPos {
|
||||
double _x_pos = 0;
|
||||
double _x_pos = 0;// 指向0°经度圈与纬度0°交点
|
||||
double _y_pos = 0;
|
||||
double _z_pos = 0;
|
||||
QVector3D getVec3() const;
|
||||
static ECEFPos fromVec3(const QVector3D& p);
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -72,5 +74,18 @@ public:
|
|||
/// <param name="azi"></param>
|
||||
/// <param name="target"></param>
|
||||
static void getTargetLLAWithDistance(const LLAPos& base, double dist, double azi, LLAPos& target);
|
||||
|
||||
/// <summary>
|
||||
/// 通过LLA坐标,获取目标极坐标
|
||||
/// </summary>
|
||||
/// <param name="base"></param>
|
||||
/// <param name="target"></param>
|
||||
/// <returns></returns>
|
||||
static PolarPos getPolarWithLLA(const LLAPos &base, const LLAPos &target);
|
||||
/// <summary>
|
||||
/// 通过极坐标,获取目标LLA坐标
|
||||
/// </summary>
|
||||
/// <param name="base"></param>
|
||||
/// <param name="target"></param>
|
||||
/// <returns></returns>
|
||||
static LLAPos getLLAWithPolar(const LLAPos &base, const PolarPos &target);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue