Xref: utzoo comp.graphics:3419 sci.math:4668 Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!vsi1!altnet!uunet!portal!cup.portal.com! From: thad@cup.portal.com (Thad P Floryan) Newsgroups: comp.graphics,sci.math Subject: Re: simple spherical algebra question Message-ID: <10243@cup.portal.com> Date: 20 Oct 88 07:19:35 GMT References: <1187@agora.UUCP> <785@uwovax.uwo.ca> <304@oink.UUCP> Organization: The Portal System (TM) Lines: 68 Re: Great Circle calculations, a while back I had need to assist a HAM operator with antenna alignment, and developed a great circle distance calculator program. The development of the solution wasn't immediately obvious to me, requiring use of haversine formulae. Extracted (below) is a portion of the tech notes of the program which you might find useful. The refs to "Bowditch" are to THE AMERICAN PRACTICAL NAVIGATOR. A second release of the program will occur after the database of all cities and landmarks on Earth has been entered; included will be graphics routines to display multiple views of the Earth (e.g. various world projections) with the chosen great circle(s). If someone uses this for missile targeting data I'm gonna be P.O.'d! :-) Thad Floryan [ thad@cup.portal.com (OR) ..!sun!portal!cup.portal.com!thad ] `` GCDIST TECHNICAL NOTES The actual calculations use haversine formulae as these avoid the ambiguity arising through use of trigonometric functions which do not indicate the quadrant in which the answer lies (ref. Bowditch, p.232). hav = haversine = 1/2 versine = (1-cosine)/2 = sin^2 angle/2 sec = 1/cos csc = 1/sin For reference, the trigonometric formulae are: cos D = sin A sin B + cos A cos B cos L sin C = cos B csc D sin L where: A = origin's latitude in degrees (+N, -S) B = destination's latitude in degrees (+N, -S) L = longitude difference between origin and destination C = course direction to destination in degrees East or West from North D = distance to destination in nautical miles/minutes of arc (1 minute of arc = 1 nautical mile = 1.1507 statute miles) The haversine formulae used by this program are: hav D = hav DLon cos L1 cos L2 + hav DLat hav C = sec L1 csc D ( hav CoL2 - hav D_CoL1 ) where: DLat = latitude difference between origin and destination DLon = longitude difference between origin and destination L1 = origin's latitude in degrees L2 = destination's latitude in degrees D = distance to destination in nautical miles/minutes of arc CoL1 = 90 - L1 CoL2 = if L1 and L2 are same name (both N or S), then 90 - L2 else 90 + L2 if contrary name (one N other S) D_CoL1 = numerical difference between D and CoL1 C = course direction labelled N or S to agree with L1, and E or W to agree with DLon. In great circle routing, L2 may be south of L1 yet have a Northerly component The haversine formulae can be reduced (for computer solution) to: D = acos ( cos DLat - (1 - cos DLon) * cos L1 * cos L2 ) C = acos ( 1 - (cos D_CoL1 - cos CoL2)/(cos L1 * sin D) ) '' (end of extract)