Hallo,
vielleicht ist auch meine hinzugefügte ( und sicher noch verbesserungsfähige ) Winkelberechnung noch von Interesse.
Klaus
'--------------------------------------------------------------------
'Distanz und Winkel zwischen zwei geogr. Punkten
Code:
$lib "double.lbx"
$regfile = "m64def.dat"
$hwstack = 32
$swstack = 32
$framesize = 96
Dim A1 As Double , A2 As Double
Dim A3 As Double , A4 As Double ,
Dim B1 As Double , B2 As Double
Dim B3 As Double , B4 As Double
Dim B5 As Double , B6 As Double
Dim B7 As Double , B8 As Double
Dim B9 As Double , B10 As Double
Dim Dist As Double , B11 As Double
Dim C1 As Double , C2 As Double
Dim C3 As Double , C4 As Double
Dim C5 As Double , Pi As Double
Dim Radian As Double , Ga As Double
Dim Be As Double , Le As Double
Dim Bf As Double , Lf As Double ,
Dim Zw As Double , Zw1 As Double
Dim Zw2 As Double , Zw3 As Double
Dim Bear As Double , Bear1 As Double
Dim Bear2 As Double , Bear3 As Double
Dim Z As String * 20 , Y As Single
Dim X As String * 10
Dim W As String * 20 , V As Single
Dim U As String * 10
Pi = 3.141592654
Radian = 0.017453292 'Pi/180
Initlcd
Cursor Off
Cls
'Koordinate 1
A1 = 49.96 'Breite Eigen (BE)
A2 = 8.2 'Laenge Eigen (LE)
'Koordinate 2
A3 = 48.96 'Breite Fremd ( BF )
A4 = 8.2 'Laenge Fremd ( LF)
'Grundformel zur Distanzberechung:
'6371.229 * Arccos(sin(a1 * Pi / 180) * Sin(a3 * Pi / 180) +
'Cos(a1 * Pi / 180) * Cos(a3 * Pi / 180)’ * Cos((a2 -a7) * Pi / 180))
'Zerlegung der Formel
'Sin(a1 * Pi / 180)
B1 = Deg2rad(a1)
C1 = Sin(b1)
'Sin(a3 * Pi / 180)
B2 = Deg2rad(a3)
C2 = Sin(b2)
'Cos(a1 * Pi / 180)
B3 = Deg2rad(a1)
C3 = Cos(b3)
'Cos(a3 * Pi / 180)
B4 = Deg2rad(a3)
C4 = Cos(b4)
'Cos((a2 -a4) * Pi / 180)
B5 = A2 - A4
B5 = Deg2rad(b5)
C5 = Cos(b5)
'B9 =(c1 * C2) +(c3 * C4 * C5)
B6 = C1 * C2
B7 = C3 * C4
B8 = B7 * C5
B9 = B6 + B8
'6371 , 229 * Arccos(b9)
B10 = Acos(b9)
Dist = B10 * 6371.229
'Winkelberechnung ( Bearing ):
'-----------------------------
Be = A1 * Radian
Le = A2 * Radian
Bf = A3 * Radian
Lf = A4 * Radian
Ga = Le - Lf
'Grundformeln zur Winkelberechung:
'Zw = Cos(be) * Cos(ga) * Cos(bf) + Sin(be) * Sin(bf)
'Zw = Atn(zw / Sqr(1 -zw * Zw))
'Zw = Pi / 2 - Zw
'Bear =((sin(bf) - Sin(be) * Cos(zw)) /(cos(be) * Sin(zw)))
'Bear = Atn(bear / Sqr(1 -bear * Bear))
'Bear =(pi / 2 -bear) / Radian
'Zerlegung der Formeln:
Zw1 = Cos(be)
Zw2 = Cos(ga)
Zw3 = Cos(bf)
Zw2 = Zw1 * Zw2
Zw3 = Zw2 * Zw3
Zw1 = Sin(be)
Zw2 = Sin(bf)
Zw2 = Zw1 * Zw2
Zw = Zw2 + Zw3
Zw1 = Zw * Zw
Zw1 = 1 - Zw1
Zw1 = Sqr(zw1)
Zw = Zw / Zw1
Zw = Atn(zw)
Zw1 = Pi / 2
Zw = Zw1 - Zw
Bear1 = Sin(bf)
Bear2 = Sin(be)
Bear3 = Cos(zw)
Bear3 = Bear3 * Bear2
Bear1 = Bear1 - Bear3
Bear2 = Cos(be)
Bear3 = Sin(zw)
Bear2 = Bear2 * Bear3
Bear = Bear1 / Bear2
Bear1 = Bear * Bear
Bear1 = 1 - Bear1
Bear1 = Sqr(bear1)
Bear = Bear / Bear1
Bear = Atn(bear)
Bear1 = Pi / 2
Bear = Bear1 - Bear
Bear = Bear / Radian
Ga = Sin(ga)
If Ga >= 0 Then Bear = 360 - Bear
Z = Str(dist)
Y = Val(z)
X = Fusing(y , "#.#")
W = Str(bear)
V = Val(w)
U = Fusing(v , "#.#")
Locate 1 , 1
Lcd "DST: " ; X ; " Km"
Locate 2 , 1
Lcd "BRG: " ; U ; " Grad"
End
Lesezeichen