Function for generating a flight path (list of three-dimensional points, lat, lon, alt)

I want to generate some 3D trajectory data for modeling an airplane. The idea is that the plane takes off at some place x and continues to rise with a certain average ascent speed a_v and angle a_theta , until it reaches the maximum height m_a . Then the plane will continue its movement m_a until it reaches a certain distance d_d from its destination, and at that moment it starts to descend at a certain angle d_theta with an average descent speed d_v . Finally, the plane lands at destination y .

I want the function to return a list of three-dimensional points.

I want to implement this in both Python (preferred) and C #.

For illustration purposes:

enter image description here

Does anyone know how I can achieve this? Could there be some open source project that does this? I searched for a while but found nothing.

+5
source share
2 answers

I recommend that you solve the problem with two independent steps so that the plane does not go through the ground:

  • Calculate the path on the surface of the sphere.
  • Interpolate the height along this path.

For 1. you can use spherical interpolation methods 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); } 
0
source

You have not written a single code, so I will not write either. Python with the math package is more than enough to solve this problem.

Necessary actions:

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

For a list of 3D points, you do not need a_v , d_v or d_d .

0
source

Source: https://habr.com/ru/post/1270429/


All Articles