prepareOptimalBearingPath

Util function to transform given bearing values to optimal ones so that shortest path is always taken.