简体   繁体   中英

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. 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 . 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 . Finally, the aircraft lands at destination y .

I would like the function to return a list of 3D points.

I am looking to implement this in either Python (preferred) or 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 :

  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 .

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.

Required steps:

  • The plane should fly on a great circle . This means you only need one distance to describe X and Y.
  • You could place the origin at X and specify Y with a latitude.
  • Calculate the tangent of the Earth at X, and rotate by a_theta . Find the point where it reaches m_a altitude.
  • Calculate the tangent of the Earth at Y, and rotate by d_theta . Find the point where it reaches m_a altitude.
  • Draw an arc between the two previous points, with a radius of EarthRadius + m_a
  • Every coordinate is known in the 2D of the great circle, you just need to rotate them back to 3D coordinates.

For a list of 3D points, you don't need either a_v , d_v or d_d .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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