I'm currently building an autonomous boat for which I define a path to follow. This path consists of multiple way points which are connected by straight lines.
The boat doesn't need to be exactly on the line between the waypoints. It will mostly be on open water so it's fine if it's a couple meters off. What I want to do is let the boat aim for a point which is 50 meters ahead on the wayline. So in the image above I added a circle around the boat with a radius of 50m. That means that I want the boat to aim for point Z. I've got the following coordinates:
Latitude Longitude
------------------------------------------
Boat: 52.42373335663094, 5.075082778930664;
X: 52.42315721146138, 5.074074268341065
Y: 52.42389341072507, 5.0763434171676645
Z: ???
I'm kinda puzzled on how I could find the coordinates of this point Z. I first assumed the earth was a flat raster (I figured that at this scale the rounding of the earth isn't that important) and tried using my best Pythagoras arithmetic, but I can't figure it out. Let alone when I also need to account for the rounding of the earth.
To complicate it even further, the 50m circle intersects twice with the wayline, so how do I know which of the two intersects is the furthest on the path? I first thought of simply measuring the distance to point X (the start of the path), but if it travels in a circle back to the start then the boat will start making shortcuts straight from start to finish.
Does anybody have an idea how I can handle these problems? How do I get the intersects with the wayline and how I can find out which of the two intersects is the furthest on the wayline? All tips are welcome!

Some ideas.
You have to transform everything to Cartesian coordinates. Assuming that the ray of the earth is 6371000m, a reference system can be established starting at point X and then calculating the desired points. Follow a script in Mathematica showing the main steps.