Converting lat long & altitude into a line of sight target?
Here's javascript source code with a detailed explanation, too long to paste into a standalone answer, but by the time this goes offline certainly a dozen more will appear if they haven't already.
https://github.com/cosinekitty/geocalc/blob/master/compass.html

Online calculator for the same:
https://doncross.net/geocalc/compass.html