Dear forum members,

I am capable of finding the coordinates where sun rays come with a direct angle at a given time/day of the year.

I would like to, just as a hobby, create a flat world map with day / night shading line layered on it.

So, how do i go from coordinates the position of sun rays to creating dots that separate illuminated (day) portion of earth on a flat map from dark portion?

I don't need codes, but the math and logic and algorithm idea behind it please. Programming part is rather easy.

But I'm stuck.

Your help will be gladly appreciated, thank you in advance.

ps. i've done a lot of googling on this. but i couldn't find any article explaning the logic behind it. the closest i came up with is "once you calculate sun's position, the rest is very simple". well, they teach how to calculate that in highschool, and i'm stuck with the rest. as i said, again, thank you a lot for your help!