PPRuNe Forums - View Single Post - Geometry/geography question
View Single Post
Old 14th June 2001 | 21:10
  #2 (permalink)  
Bally Heck
Guest
 
Posts: n/a
Post

You've asked for it

Some great circle formulae:

The great circle distance d between two points with coordinates
{lat1,lon1} and {lat2,lon2} is given by:

d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))

a mathematically equivalent formula, which is less subject to rounding
error for short distances is:

d=2*asin(sqrt((sin((lat1-lat2)/2))^2 +
cos(lat1)*cos(lat2)*(sin((lon1-lon2)/2))^2))

And...

The initial course, tc1, (at point 1) from point 1 to point 2 is
given by:
if sin(lon2-lon1)<0
tc1=acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
else
tc1=2*pi-acos((sin(lat2)-sin(lat1)*cos(d))/(sin(d)*cos(lat1)))
endif

Intermediate points {lat,lon} lie on the great circle connecting
points 1 and 2 when:

lat=atan((sin(lat1)*cos(lat2)*sin(lon-lon2)
-sin(lat2)*cos(lat1)*sin(lon-lon1))/(cos(lat1)*cos(lat2)*sin(lon1-lon2)))
(not applicable for meridians. i.e if sin(lon1-lon2)=0)

Of course that's just of the top of me head (yea right) so check it carefully. No liability taken if you run out of fuel.

Oh nearly forgot....these tracks are true. If you want magnetic then I suggest you take the average variation between the two points and add or subtract them.
Happy programming :-)

[This message has been edited by Bally Heck (edited 14 June 2001).]

[This message has been edited by Bally Heck (edited 15 June 2001).]