There is an ArcTangent function. To avoid losing sign I use thisWorks fine as Single too in most casesCode:Option Explicit Public Const PI As Double = 3.14159265358979 Public Const PI½ As Double = 1.5707963267949 Public Function ATan2(ByVal Dy As Double, ByVal Dx As Double) As Double If Dx = 0 Then ATan2 = PI½ * Sgn(Dy) Else ATan2 = Atn(Dy / Dx) If Dx < 0 Then ATan2 = ATan2 + PI End If End Function




Reply With Quote