Automatic Generation of Complex Spatial Trajectories of the UAV and Synthesis of Control