Function PI() As Double PI = 4 * Atn(1) End Function Function RadDeg(x As Double) As Double '------------------------------------------------------------------- ' Pretvara radiane u stepene '------------------------------------------------------------------- RadDeg = x / PI() * 180 End Function Function Azimut(X1 As Single, Y1 As Single, X2 As Single, Y2 As Single) As Single Dim Dx As Single Dim DY As Single Dim Ugao As Double Dx = X1 - X2 DY = Y1 - Y2 Ugao = Atn(Abs(DY) / Abs(Dx)) If Dx < 0 Then If DY < 0 Then Ugao = Abs(Ugao) + PI Else Ugao = PI - Abs(Ugao) End If Else If DY < 0 Then Ugao = (2 * PI) - Abs(Ugao) End If End If Ugao = RadDeg(Ugao) Azimut = Format(Ugao, "0.00") End Function