# Calculating flightpath

This topic is 3955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I've draw a heightmap in openGL, now I want to add a flight path which a plane would follow (like in In-Flight-Entertainment systems on commercial flights). I've got the coordintates of the 2 points I want to join. What I want to acheive is draw a curve that connects the 2. The curve needs to have an altitude of 0 at both points and at the highest point have an altitude of 10,000. Is there an equation that I can use in order to define the altitude of various points along the path? Thanks for any help.

##### Share on other sites
You can try doing it using a circle. You know that there is only one circle going through three points, and you have three points: your origin, destination, and middle (+ 10000 units of altitude). You can try making a circle out of those points and extract from it the arc you need.

##### Share on other sites
There are many many many ways to interpolate between those two points. Bezier Splines, a line, a slerp,... It depends on what kind of path you want the plane to take.

##### Share on other sites
This might help make it easier to understand:

I've got the 2 points specified by (x1, y1) and (x2, y2), and I've joined them by drawing a line (v1) between them. This line has a Z coordinate of 0 all the way along.

What I want to acheive is something that looks more like an line (arc) v2. The maximum Z coordinate along this line should be 10,000 and it should have a Z coordinate at both points (x1, y1) and (x2, y2).

What I need is an equation that satisfies this arc, then I can simply plug in the coordinates to find the Z coordinate value at that particular position.

Thanks again. :)

##### Share on other sites
One method would be to fit a quadratic curve to this path.

y = ax^2 + bx + c

where a, b and c are unknowns, y is the height (Z in your example) and x is the distance along the line v1

Let d = the length of v1
Let h = the max height (10000 in your example)

You know that,

when x=0, y=0 (so c must be 0)
when x=d/2, y=h
when x=d, y=0

so,
h = a(d/2)^2 + b(d/2)
and

Solving this gives,

a=-4h/(d^2) and b=4h/d

y = (-4h/(d^2))x^2 + (4h/d)x

where x is the distance along the line v1, and y is your Z

##### Share on other sites
Planes fly at more or less constant cruising altitude for most of the time. The takeoff and climb follows whatever path the aircraft is designed for (generally, get to the cruising altitude as fast as possible). When landing, the plane typically descends along a line that's in a 3 degree angle from horizontal. So a more realistic display of the flight path would be angled lines for takeoff/landing and a straight line for the cruise.

The in-flight route displays on planes don't show the altitude along the route. The line is curved because the plane follows a great circle which is the shortest way to the destination.

##### Share on other sites
Thanks very much for all your help. I take your point Fingers about the flightpath, but accuracy isn't that important for me, I'd ather have something that is a little more visually pleasing even if it's a little un-accurate. So I'm going to try and have a go at using WillC's quadratic formula. This was what I wanted in the first place but I was just unsure about how to construct the formula, so thank you very much. :)

1. 1
2. 2
3. 3
Rutin
20
4. 4
khawk
14
5. 5

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633655
• Total Posts
3013186
×