- Home
·
- Math/Dates
·
- Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -p
Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -p
Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -pi given the y,x components (rise/run)
Rate Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -p
(1(1 Vote))
On Error GoTo DivideError
Atn2 = Atn(y / x)
If (x < 0) Then
If (y < 0) Then Atn2 = Atn2 - vbPI Else Atn2 = Atn2 + vbPI
End If
Exit Function
DivideError:
If Abs(y) > Abs(x) Then 'Must be an overflow
If y > 0 Then Atn2 = vbPI / 2 Else Atn2 = -vbPI / 2
Else
Atn2 = 0 'Must be an underflow
End If
Resume Next
End Function
Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -p Comments
No comments yet — be the first to post one!
Post a Comment