-
Notifications
You must be signed in to change notification settings - Fork 3
FlightPlanComponent
This class is initialised by AircraftController, and only one instance exists at a time. This class is responsible for the creation of flight plans using data from WaypointComponent, which is required by AircraftController whenever a new aircraft is created. AircraftController calls Generate() which returns a list of waypoints, where the first item is the aircraft’s point of entry and the last is the aircraft’s point of exit. This class fulfils SR6.
Flight plan generation is done in such a way that all aircraft with the same entry-exit point pair will follow the same flight plan.
-
An entry point is selected at random from
WaypointComponent.entryListand added toflightPlan -
An exit point is selected at random from
WaypointComponent.exitListthat is a minimum distance away from the entry point. -
The recursive function
flightPlanWaypointGenerator()is called, taking three parameters: the latest waypoint to be added toflightPlan; the exit waypoint of the aircraft; and the flight plan itself. The base case of this recursive function is when the last item of flightPlan is the aircraft’s exit waypoint. -
flightPlanWaypointGenerator()callsselectNextWaypoint()once. This method selects the next waypoint (frompermanentlistconcatenated withlastWaypoint) to add to the flight plan, under the following constraints:a. Must be a minimum distance from both the current waypoint and last waypoint.
b. The absolute value of the angle between the current and potential waypoints and the angle between the current and last waypoints must be less than a specified minimum angle
c. The next waypoint must not be the current waypoint.
-
The waypoint chosen by part 4 added to the
flightPlan. Return to 3.
Currently the generated flight plan is dependent on the order of the waypoints in WaypointComponent.permanentList, as part 4 iterates through the list from first to last, meaning that the first few items in the list have a very high probability of being chosen.