Basic method for theory to counteract turning at chicanes and sharp turns (at present it is far too sharp and tends towards the edges of the track).
If further testing proves this to be ineffective or problematic in that it includes delays of some sections, a second theory is:
Method 2 - Change the circle radius checked for a specific number of iterations.