我想找到两个坐标点之间的方位
这里是坐标点
Dim FNorth_Point= 42.141622 Dim FEast_Point= -84.474162 ' //first position
Dim SFNorth_Point= 40.691682 Dim SEast_Point= -83.243693 '//Second position:
If FNorth_Point = SFNorth_PointNorth_Point And FEast_Point = SEast_Point Then
MessageBox.Show("Make sure you entered the Latitude and longitude")
Else
Dim theta As Double = FNorth_Point - SFNorth_PointNorth_Point
Dim dist As Double = Math.Sin(deg2rad(FEast_Point)) * Math.Sin(deg2rad(SEast_Point)) + Math.Cos(deg2rad(FEast_Point)) * Math.Cos(deg2rad(SEast_Point)) * Math.Cos(deg2rad(theta))
dist = Math.Acos(dist)
dist = rad2deg(dist)
Dim finalDist As Double = dist * 1.1515
SBTBW.Text = finalDist
Dim SBBx = CInt(SBTBW.Text) ' convert to integer
SBTBW.Text = SBBx
End If
Private Function deg2rad(ByVal deg As Double) As Double
Return (deg * Math.PI / 180.0)
End Function
Private Function rad2deg(ByVal rad As Double) As Double
Return (rad / Math.PI * 180.0)
End Function
请随时纠正我。谢谢