Predmet:Re: Queries vece manje
Evo ti moj kod:
PreuzmiIzvorni kôd (Visual Basic):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
a evo i Query:
PreuzmiIzvorni kôd (SQL):SELECT x.[1] AS x_1, y.[1] AS y_1, y.[2] AS y_2, x.[2] AS x_2, Sqr((([x_2]-[x_1])^2)+(([y_2]-[y_1])^2)) AS metara, RacunK(x.[1],x.[2],y.[1],y.[2])+Sqr((Atn(([x_2]-[x_1])/([y_2]-[y_1]))*57.29577951)^2) AS stepeni, Azimut([x].[1],[y].[1],[x].[2],[y].[2]) AS AZ
FROM x INNER JOIN y ON x.id_x = y.id_y;
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.