简体   繁体   English

生成飞行轨迹的功能(3D点列表,lat,lon,alt)

[英]Function to generate flight trajectory (list of 3D points, lat, lon, alt)

I am looking to generate some 3D trajectory data for an aircraft simulation. 我期待为飞机模拟生成一些3D轨迹数据。 The idea is that the aircraft takes off at some location x and continues to ascend at some average ascent velocity a_v and angle a_theta until it reaches a maximum altitude m_a . 该想法是飞机在某个位置x处起飞并且继续以某个平均上升速度a_v和角度a_theta上升直到其达到最大高度m_a The aircraft would then continue at its m_a until it reaches a certain distance d_d from its destination, at which point it will begin its descent at some angle d_theta with an average descent velocity of d_v . 然后飞机将继续其m_a直到它从目的地到达某个距离d_d ,此时它将以某个角度d_theta开始下降,其平均下降速度为d_v Finally, the aircraft lands at destination y . 最后,飞机降落在目的地y

I would like the function to return a list of 3D points. 我希望该函数返回一个3D点列表。

I am looking to implement this in either Python (preferred) or C#. 我希望在Python(首选)或C#中实现它。

For illustration purposes: 用于说明目的:

在此输入图像描述

Does anyone know how I can achieve this? 有谁知道我怎么能做到这一点? Is there perhaps some open source project which does this? 是否有一些开源项目可以做到这一点? I have been looking for a while now, but have not found anything. 我一直在寻找一段时间,但没有找到任何东西。

I recommend you to solve the problem in 2 independent steps so that the airplane does not pass through the ground : 我建议你通过2个独立的步骤解决问题,这样飞机就不会穿过地面了:

  1. Calculate the path on the surface of a sphere. 计算球体表面上的路径。
  2. Interpolate the height along this path. 沿此路径插入高度。

For 1. you can use the spherical interpolation techniques on Quaternions . 对于1.您可以在四元数上使用球面插值技术

Quaternion slerp(Quaternion v0, Quaternion v1, double t) {
    // Only unit quaternions are valid rotations.
    // Normalize to avoid undefined behavior.
    v0.normalize();
    v1.normalize();

    // Compute the cosine of the angle between the two vectors.
    double dot = dot_product(v0, v1);

    const double DOT_THRESHOLD = 0.9995;
    if (fabs(dot) > DOT_THRESHOLD) {
        // If the inputs are too close for comfort, linearly interpolate
        // and normalize the result.

        Quaternion result = v0 + t*(v1 – v0);
        result.normalize();
        return result;
    }

    // If the dot product is negative, the quaternions
    // have opposite handed-ness and slerp won't take
    // the shorter path. Fix by reversing one quaternion.
    if (dot < 0.0f) {
        v1 = -v1;
        dot = -dot;
    }  

    Clamp(dot, -1, 1);           // Robustness: Stay within domain of acos()
    double theta_0 = acos(dot);  // theta_0 = angle between input vectors
    double theta = theta_0*t;    // theta = angle between v0 and result 

    Quaternion v2 = v1 – v0*dot;
    v2.normalize();              // { v0, v2 } is now an orthonormal basis

    return v0*cos(theta) + v2*sin(theta);
}

You didn't write any code, so I won't write any either. 你没有写任何代码,所以我也不会写任何代码。 Python with math package is more than enough to solve this problem. 带有math包的Python足以解决这个问题。

Required steps: 所需步骤:

  • The plane should fly on a great circle . 飞机应飞得很大 This means you only need one distance to describe X and Y. 这意味着您只需要一个距离来描述X和Y.
  • You could place the origin at X and specify Y with a latitude. 您可以将原点放在X处并指定具有纬度的Y.
  • Calculate the tangent of the Earth at X, and rotate by a_theta . 计算X处地球的切线,并按a_theta旋转。 Find the point where it reaches m_a altitude. 找到它达到m_a高度的点。
  • Calculate the tangent of the Earth at Y, and rotate by d_theta . 计算地球在Y处的切线,并按d_theta旋转。 Find the point where it reaches m_a altitude. 找到它达到m_a高度的点。
  • Draw an arc between the two previous points, with a radius of EarthRadius + m_a 在前两个点之间绘制一条弧,半径为EarthRadius + m_a
  • Every coordinate is known in the 2D of the great circle, you just need to rotate them back to 3D coordinates. 每个坐标都在大圆的2D中已知,您只需将它们旋转回3D坐标即可。

For a list of 3D points, you don't need either a_v , d_v or d_d . 对于3D点列表,您不需要a_vd_vd_d

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM