# great circle revisited

## Recommended Posts

Trying to plot a course between 2 sets of coordinates Lat1 = (A:GPS POSITION LAT, radians)Lon1 = (A:GPS POSITION LON, radians)And a point selected by the pilot (lat & lon) Searched through the forum

##### Share on other sites
 Help AVSIM continue to serve you!Please donate today!

If you're just trying to get the bearing to the second set of coodinates, this should help.(*INPUT: LAT1,LON1,LAT2,LON2*) @1 sin @3 sin * @1 cos @3 cos * @2 @4 - cos * + acos (*INPUT: LAT1,LON1,LAT2,LON2*)pi 2 * @3 sin @1 sin @GC_DISTANCE(@1, @2, @3, @4) s0 cos * - @1 cos l0 sin * / acos @4 @2 - sin 0 < if{ - } els{ + } rddg dnor dgrdIn order to get the bearing, you need the GC distance. So in this set of macros, calling CG_BEARING will automatically get the distance for you. Of course you can also use CG_DISTANCE independently if needed.All inputs and results are in rads. Note that I avoided the 'rnor' function, since it seems to be broken. Instead use rddg dnor dgrd, or skip the dgrd if you want your results in degrees.This is the direct course to the second set of coordinates following a great circle, so if you want to account for wind drift you'll need to plug in the appropriate correction.

##### Share on other sites

Hi,Do you mean this one?http://forums.avsim.net/dcboard.php?az=sho...ing_type=searchWhen home i have some formulas which give heading and distance from plane to any point.Jan"Beatus ille qui procul negotiis..."

##### Share on other sites

Hi Ridgell,I would recommend to use the gps calls as their calcs must be the same used by FS engine to plot course/distance:C:fs9gps...(L:YourLatitudeFrom,degrees) (>@c:GeoCalcLatitude1,degrees) (L:YourLongitudeFrom,degrees) (>@c:GeoCalcLongitude1,degrees) (L:YourLatitudeTo,degrees) (>@c:GeoCalcLatitude2,degrees) (L:YourLongitudeTo,degrees) (>@c:GeoCalcLongitude2,degrees) (@c:GeoCalcBearing,degrees) (>L:FromToBearing,degrees)(@c:GeoCalcDistance,nmiles) (>L:FromToDistance,nmiles)...That's it -no need to manage complex calcs :-)Tom

##### Share on other sites

great moogally boogally!here i was digging away with my hands and you guys show up with a back hoe and a steam shovel. tom trying the gps vesion 1st, *seems easier* (L:YourLatitudeFrom,degrees) would be the (A:GPS POSITION LAT,degrees) and the (L:YourLatitudeTo,degrees) would be the user input latitude,degrees etc?

##### Share on other sites

Hi,Right, i use (A:PLANE LATITUDE,degrees) and (A:PLANE LONGITUDE,degrees) and (@c:GeoCalcBearing,degrees) (A:MAGVAR,degrees) - (>K:HEADING_BUG_SET) Jan"Beatus ille qui procul negotiis..."

##### Share on other sites

yes, it comes 1st in the sdk "position & speed" is before "avionics & gps" but in my forum searching for lat lon and GC route, i came across a post where some was complaining about (A:PLANE LATITUDE,...) because FS was dividing it by something, it was a little over my head, but i switched Vars just in case, but you say it is the same or better, i will take your word.

##### Share on other sites

Ridgell,I prefer to use Plane Latitude because it updates on every cycle instead of GPS Positiom AVar that updates every three cycles. Haven't found any trouble so far. As Jan stated, bearing is a True North reference then you must substract MagVar to obtain magnetic info.Tom

##### Share on other sites

Those GPS calcs are a great resource/performance saver, but I only use them in instances where I don't need continuous updates. The slow iteration rate of the GPS calls make for some pretty choppy indications, particularly if there's graphics associated with it.So there's definitely advantages to the sledge-hammer approach (at least in my stuff), but hopefully Ridgell can get by with the GPS calls. They ARE much cheaper if the slower speed is acceptable.

##### Share on other sites

Jon,GeoCalc functions can be called more than once in a gauge, and they return their values immediately, so there is no penalty in their use. Which IS slow is the A:GPS... set of avar's values. That's the reason for me to use Plane Lat/Lon values present and past, combined with the GeoCalc calls to obtain the a/c tracking/bearing on each cycle.Tom

##### Share on other sites

i am attempting to simulate an internal navigation system, one of the 60s-70s types that were gyro driven, the out put will be digital and an RMI/ADF type gauge, speed is not an issue as the course should not experiance rapid change, and the display on the analog gauge has a built in delay, magnetic variation will also not apply as the system is independent of the mag compass. the spin gyros were not accurate to land with, just good enough to get you within eye shot. they could be accurate if you gave them a long enough spin up...we never did! peace time flying for NATO was doled out as Hobbs time and to precious to use sitting on the tarmac.

##### Share on other sites

Ah, interesting, Tom! I knew the PLANE LAT/LON responded at the gauge refresh rate, but I foolishly assumed the ALL the GPS calls were similarly gimped. I must have used the GPS LAT/LON last time I tried it. Either that or something else was bottlenecking the result. I'll give it a revisit.

##### Share on other sites

Now that's a cool project. Please keep us posted with how it's working out.

## Create an account

Register a new account

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!