'-------------------------------------------------------------------------------------------------------
Dim Const LEFT = -1, RIGHT = 1 As Short
'-------------------------------------------------------------------------------------------------------
Dim turningDirection As Short
Dim turningAngle, smallestAngle As Double
Dim angleDifferenceA, angleDifferenceB, absAngDiffA, absAngDiffB As Double
'-------------------------------------------------------------------------------------------------------
angleDifferenceA = h2 - h1
angleDifferenceB = angleDifferenceA - 360
absAngDiffA = Abs(angleDifferenceA)
absAngDiffB = Abs(angleDifferenceB)
smallestAngle = Min(absAngDiffA, absAngDiffB)
'-------------------------------------------------------------------------------------------------------
If smallestAngle = absAngDiffA Then turningAngle = angleDifferenceA Else turningAngle = angleDifferenceB
'-------------------------------------------------------------------------------------------------------
If turningAngle < 0 Then
turningDirection = LEFT
Else _
If turningAngle > 0 Then
turningDirection = RIGHT
End If
'-------------------------------------------------------------------------------------------------------