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
 Dieter Senior Member Posts: 2,397 Joined: Dec 2013
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?

Dieter
 « Next Oldest | Next Newest »

 Messages In This Thread Mercator Sailing: Course and Distance - Eddie W. Shore - 08-10-2018, 03:08 AM RE: Mercator Sailing: Course and Distance - PedroLeiva - 08-10-2018, 11:23 AM RE: Mercator Sailing: Course and Distance - Dieter - 08-12-2018, 05:13 PM RE: Mercator Sailing: Course and Distance - Eddie W. Shore - 09-22-2018, 11:37 PM RE: Mercator Sailing: Course and Distance - Gene222 - 08-24-2018, 07:21 PM RE: Mercator Sailing: Course and Distance - Dieter - 08-25-2018, 06:08 AM RE: Mercator Sailing: Course and Distance - Eddie W. Shore - 09-22-2018, 11:39 PM RE: Mercator Sailing: Course and Distance - Gene222 - 08-26-2018, 12:30 AM RE: Mercator Sailing: Course and Distance - Dieter - 08-26-2018, 07:18 AM RE: Mercator Sailing: Course and Distance - Albert Chan - 09-10-2022, 03:17 PM RE: Mercator Sailing: Course and Distance - Gene222 - 08-28-2018, 12:46 AM RE: Mercator Sailing: Course and Distance - Dieter - 08-28-2018, 08:53 AM RE: Mercator Sailing: Course and Distance - Dieter - 08-28-2018, 04:49 PM RE: Mercator Sailing: Course and Distance - Gene222 - 08-29-2018, 09:02 PM RE: Mercator Sailing: Course and Distance - Dieter - 08-30-2018, 05:49 AM RE: Mercator Sailing: Course and Distance - Gene222 - 08-30-2018, 11:59 PM RE: Mercator Sailing: Course and Distance - Gene222 - 08-31-2018, 02:15 AM RE: Mercator Sailing: Course and Distance - Dieter - 08-31-2018, 05:46 AM RE: Mercator Sailing: Course and Distance - Dieter - 09-01-2018, 05:51 AM RE: Mercator Sailing: Course and Distance - VadimV - 12-21-2022, 08:31 PM RE: Mercator Sailing: Course and Distance - Gene222 - 09-01-2018, 02:52 AM RE: Mercator Sailing: Course and Distance - Gene222 - 09-02-2018, 04:03 PM RE: Mercator Sailing: Course and Distance - Dieter - 09-02-2018 06:27 PM RE: Mercator Sailing: Course and Distance - Gene222 - 09-03-2018, 10:10 PM RE: Mercator Sailing: Course and Distance - Dieter - 09-04-2018, 07:19 PM RE: Mercator Sailing: Course and Distance - Gene222 - 09-05-2018, 05:46 PM

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