Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hi, all!

I'm programming a radar to keep track of AI traffic.

Anyone know the BEST code for determining the MOST ACCURATE distance of AI based on both our LAT and LON's?? I want to be quite specific cuz I'm using distance trend data to perform trajectory projection and closure rate calculations...

Is there another way to get accurate AI traffic distances?

I'm coding in VB using FSUIPC.

Thanks!

Danny

Posted

this is what i use

Public Function fix_to_fix_distance(lat1 As Single, lon1 As Single, lat2 As Single, lon2 As Single) As Single

Dim pi As Double

Dim degtorad As Double

Dim latx1 As Double

Dim latx2 As Double

Dim lonx1 As Double

Dim lonx2 As Double

pi = 3.1415926535

degtorad = (pi / 180)

latx1 = lat1 * degtorad

latx2 = lat2 * degtorad

lonx1 = -lon1 * degtorad

lonx2 = -lon2 * degtorad

fix_to_fix_distance = ArcCos((Sin(latx1) * Sin(latx2)) + (Cos(latx1) * Cos(latx2) * Cos(lonx1 - lonx2)))

fix_to_fix_distance = fix_to_fix_distance * 180 * 60 / pi

End Function

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.