# NavList:

## A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding

**Re: POL and arctan2**

**From:**George Huxtable

**Date:**2005 Nov 11, 16:59 -0000

Bill wrote, about extracting further information than azimuth from the rectangluar to polar conversion I had quoted >I feared I was too hasty thinking about it in > transit. Returning home, I found all but the below was pure gibberish as > I > managed to get caught in my own circular argument. > > While there is a high correlation between the first value returned from > R-to-P and cosine of Hc, they are not nearly close enough for any > meaningful > use in navigation. > > Back to the drawing board. ============================== Alas, he is not the only one to be writing nonsense. Nearly all of my own last posting on this topicwas complete hokum. Please tear it up and throw it in the bin. It's true that when you compute (R,A), in polar coordinates, using the function ATAN2 or POL ( tan dec cos lat - cos LHA sin lat , - sin LHA) the resulting angle A gives the true azimuth. This is simple, useful, and direct, providing azimuth in the range -180, through zero, to +180. If you prefer, you can add 360 to a negative azimuth to put it into the range 0 to 360. ========================= In addition to an azimuth A, that function also returns another result, R. What Bill asked was whether the resulting R value provided any useful information., or just had to be discarded. A sensible question. I suggested (rather tentatively, because I couldn't see how to prove it) that the R value appeared to correspond to Tan (90 - altitude), just from a few numerical test-results. I've now checked more thoroughly, and can now state that that conclusion applied only in certain special circumstances, and is NOT generally valid. So now, that suggestion must be withdrawn. It just ain't so. Sorry about that. So my answer to Bill's question is that as far as I can see it, the R-value that emerges from use of that rectangular to polar conversion function is of no use at all, and has to be discarded. ========================= To compute the altitude of the body, Meeus' formula 13.6 should be used, which is- alt = arcsin (sin lat sin dec + cos lat cos dec cos LHA) ===========================. The equivalent formulae, for getting great-circle course and distance, from position 1 (lat1, long1) to position 2 (lat2 long2), involves working out dlong = long2 - long1 (and getting the sign right; see below) Then apply the function atan2 or POL ( tan lat2 cos lat1 - cos dlong sin lat1, - sin dlong) which gives two values, R and A. Discard R, and A is the required course. If it's negative, add 360. And for distance, in miles, use dist = 60* (arc cos( sin lat1 sin lat2 + cos lat1 cos lat2 cos dlong)) this is adapted from Meeus 13.6. In these expressions, the signs have to be taken seriously, North positive, South negative; longitudes and hour angles are positive Westwards. Then azimuth and course are positive clockwise from North. George. contact George Huxtable at george@huxtable.u-net.com or at +44 1865 820222 (from UK, 01865 820222) or at 1 Sandy Lane, Southmoor, Abingdon, Oxon OX13 5HX, UK. .