I think Aussie Andy has already answered the question. The algorithm isn't a particularly difficult one. It is related to the algorithm that determines what lead an ILS GPS applies to warning you of the need for a change of HSI heading over a waypoint - the greater the angle of turn, the more the GPS anticipates the turn instruction.
2D