Optimal trajectories in atmospheric flight