Post Reply 
Mercator Sailing: Course and Distance
09-02-2018, 06:27 PM (This post was last modified: 09-02-2018 06:55 PM by Dieter.)
Post: #19
RE: Mercator Sailing: Course and Distance
(09-02-2018 04:03 PM)Gene222 Wrote:  I incorporated most of the changes you suggested. Attached is the revised program.

Looks very good now – thumbs up. ;-)

I tried to read the program by removing the header and trailer portion of the .hpprgm file and then delete all null bytes. And I'd suggest two changes:

– The allowed latitude range is 0 ≤ L < 90°. So an input of 90° is not permitted. This can be handled by a few simple changes in the respective tests. More precisely, the largest latitude is ~89,99994° as sin(89,99995°) already rounds to 1 and artanh(1) is not defined. So this is the limit. You may simply check if sin(lat)=1. Or maybe you should limit the latitude to something more sensible like 89° or even 85° which seems more adequate for maps with Mercator projection. This also addresses the reduced accuracy issue of the original artanh(sin) formula close to 90°.

– Instead of checking whether lat1 = lat2 I think it's safer to compare the corresponding meridional parts, i.e. check if MeridPartDiff=0. You never know when roundoff errors may occur. ;-) However, if the latitude minute input is limited to 3 decimals (don't know how the Prime behaves here) no change is required.

Edit: I just noticed this line in the East-West portion of the code: BearingQuad:="2 (NW)"; Shouldn't this be "4 (NW)"?
And in the distance formula the two constants "60" cancel out and thus can be removed.

Finally: what about one or two examples for an exact East-West or West-East course?

Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Mercator Sailing: Course and Distance - Dieter - 09-02-2018 06:27 PM

User(s) browsing this thread: 1 Guest(s)