Ok Gary,
Have a look at this. Been done for a while but a few little formatting things are not quite right. It uses the phone gps and I have found that the initial fixes are often quite inaccurate, not sure how to get around this.
rawcdn.githack.com/dna0xff/recipes/master/testOffcourse.htmlHappy for feedback and comments and please treat it as a work in progress. I have tested the algorithms in all hemispheres and course quadrants but not on any boundary situations like sailing across the antimeridian or the equator.
It's a single file browser application so all there to look at how it works if you are interested.