Draw a line between an observer and the current direction of the sun

55 Views Asked by At

My goal is to draw a line between an observer and the current direction of the sun.

Given the observers coordinates (Lat, Lon) of (51.50442, -0.08630) a North of (90, 0), an Azimuth of 270 degrees and an altitude of 30 degrees how can I get the coordinate of the direction of the sun?

This website shows the line I'm trying to draw on a map in yellow.

My thought process so far is to rotate the North line about the observers origin. I know I can rotate a line about its origin in 2D space with this formula:

x1 = x cos - y sin

y1 = x sin + y cos

but i'm struggling to work out how to do it on the surface of a sphere.

Thanks for any help.

Edit:Added altitude info.