簡體   English   中英

生成飛行軌跡的功能(3D點列表,lat,lon,alt)

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

我期待為飛機模擬生成一些3D軌跡數據。 該想法是飛機在某個位置x處起飛並且繼續以某個平均上升速度a_v和角度a_theta上升直到其達到最大高度m_a 然后飛機將繼續其m_a直到它從目的地到達某個距離d_d ,此時它將以某個角度d_theta開始下降,其平均下降速度為d_v 最后,飛機降落在目的地y

我希望該函數返回一個3D點列表。

我希望在Python(首選)或C#中實現它。

用於說明目的:

在此輸入圖像描述

有誰知道我怎么能做到這一點? 是否有一些開源項目可以做到這一點? 我一直在尋找一段時間,但沒有找到任何東西。

我建議你通過2個獨立的步驟解決問題,這樣飛機就不會穿過地面了:

  1. 計算球體表面上的路徑。
  2. 沿此路徑插入高度。

對於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);
}

你沒有寫任何代碼,所以我也不會寫任何代碼。 帶有math包的Python足以解決這個問題。

所需步驟:

  • 飛機應飛得很大 這意味着您只需要一個距離來描述X和Y.
  • 您可以將原點放在X處並指定具有緯度的Y.
  • 計算X處地球的切線,並按a_theta旋轉。 找到它達到m_a高度的點。
  • 計算地球在Y處的切線,並按d_theta旋轉。 找到它達到m_a高度的點。
  • 在前兩個點之間繪制一條弧,半徑為EarthRadius + m_a
  • 每個坐標都在大圓的2D中已知,您只需將它們旋轉回3D坐標即可。

對於3D點列表,您不需要a_vd_vd_d

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM