Sub modifierCurrentRotation(rotation As Double)
' Constants declared other place:
'conFirstModifier=42500000/Power(11.25,1.6)/25000000000
'conSecondModifier=(78500000-42500000)/Power(11.25,1.8)
'conThirdModifier=78500000
'conFourthModifier=25000000000
' Might not have a positive rotation
Do While rotation<0
rotation=rotation+3600
Loop
' Deviation is the same for every 45 degrees of the circle
rotation = rotation Mod 45
' Deviation is symmetric around 22.5 degrees
If rotation>22.5 Then
rotation=45-rotation
End If
' One function for the first half of the interval, and another function for the other half of the interval
If rotation<=11.25 Then
Return 1+Power(rotation,1.6)*conFirstModifier
Else
Return 1+(conThirdModifier-Power(22.5-rotation,1.8)*conSecondModifier)/conFourthModifier
End If
End Sub