The simFlight Network Forums

jyoungken

Members

3

Community Reputation

0 Neutral

• Rank
Newbie
• Birthday 01/01/1970

• Website URL
http://
1. Found a problem in the VB.NET SDK sample

Anytime. If I find anything else while debugging my program, I'll post them. Jim
2. Found a problem in the VB.NET SDK sample

Too weird, didn't log me in. Having cookie problems or something. Jim
3. Metar Station

Here is a small vb.net function that will calculate the great circle distance between two points. input is in decimal degrees. it will return miles, kilometers, nautical miles. Hope this is helpful. Jim Imports System Imports Microsoft.Win32 Module UtilityRoutines Function distance(ByVal lat1, ByVal lon1, ByVal lat2, ByVal lon2, ByVal unit) '--------------------------------------------------------------------------- ' this routine calculates the distance between two points (given the ' latitude/longitude of those points). ' ' definitions: ' south latitudes are negative, east longitudes are positive ' ' passed to function: ' lat1, lon1 = latitude and longitude of point 1 (in decimal degrees) ' lat2, lon2 = latitude and longitude of point 2 (in decimal degrees) ' unit = the unit you desire for results ' where: 'm' is statute miles (default) ' 'k' is kilometers ' 'n' is nautical miles '--------------------------------------------------------------------------- Dim radlat1 As Double = Math.PI * (lat1 / 180) Dim radlat2 As Double = Math.PI * (lat2 / 180) Dim radlon1 As Double = Math.PI * (lon1 / 180) Dim radlon2 As Double = Math.PI * (lon2 / 180) Dim theta As Double = lon1 - lon2 Dim radtheta As Double = Math.PI * (theta / 180) Dim dist As Double dist = Math.Sin(radlat1) * Math.Sin(radlat2) + Math.Cos(radlat1) * Math.Cos(radlat2) * Math.Cos(radtheta) dist = Math.Acos(dist) dist = (dist * 180) / Math.PI dist = (dist * 60) * 1.1515 Select Case LCase(unit) Case "k" dist = dist * 1.609344 Case "n" dist = dist * 0.8684 End Select Return dist End Function End Module
×
×
• Create New...