How can I calculate a flightpath given a set of waypoints?
The Haversine equations will calculate the bearing and distance between any latitude/longitude pair, and can calculate the location and next bearing for points along a Great Circle. 

They go back to the days of sail, shortly after the invention of the marine chronometer, which allowed calculation of the current longitude. As such they assume that the points are on the surface of an idea sphere; as Earth is slightly oblate, there is an error of upto 0.6% in calculations of locations. For any realistic altitude, the oblateness (23 km difference between polar and equatorial radius) is likely to be larger than the change in altitude.

A discussion of them is here http://www.movable-type.co.uk/scripts/latlong.html