by Paul D. Cary (1 Submission)
Category: Math/Dates
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 6th August 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -pi given the y,x components (rise/run)
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
No comments have been posted about Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -p. Why not be the first to post a comment about Visual Basic implementation of the Atn2 function. Calculates the angle in radians between +pi to -p.