-
Notifications
You must be signed in to change notification settings - Fork 0
Route Calculation
The backend provides functionality to calculate routes, in this page we will describe the algorithms behind the route calculation.
Both route planning algorithms work by dividing a common route into sections. This common route is defined by simply following the coastline, then we divide into sections based on the starting points i.e, slipways and beaches.
Here is a diagram of an island, the red is the common route all the kayaks follow and the green are the slipways and beaches from where you can start. We then divide the route into sections based on the slipways.
The point to point route generator works by generating routes a subset of start points. It starts by simply generating routes each one representing one section as shown above. Then the algorithm joins them iteratively, from each start point creating longer and longer routes. It then terminates once a certain number of routes has been generated and returns them in descending distance order.
The circular route generator works by randomly picking sections and finding "switchpoints" for them. i.e when the tide switches direction with respect to the route.
13:00
14:00
Then based on the time of this switch point begins stepping backward and forward simultaneously until it reaches a minimum distance. For each of the sections it steps over it checks that the tide is still supporting it in both the forward and back directions.
If it reaches the minimum distance without tide pushing against it, it returns the route, if not it tries another switch point, and if that doesn't work it attempts another section on which to switch.