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!

Recommended Answers

All 7 Replies

>>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?

Can you clarify a bit more?

Well,

Imagine Earth and its declination depending the time of the year, as it moves around the sun.
So each day, and hour, sun rays come to a different place on earth with a direct angle. Nowadays on Southern Hemisphere..
So, from what I have been reading and thinking, finding those coordinates is the way to begin.
Calculating sun's position from earth and other geographical calculations are also not a problem.

So I kind of think that I don't have any "maths" related issues regarding gathering the data.

So from this point on, how can i use these geographical data, generated by known math equations regarding earth & sun, to create a flat world map with a line separating day & night parts. (if possible a half-shaded area in between to show the transition but this is not indispensable.)

Please excuse me if I'm wrong about any of this, and please feel free the correct.

And again, thank you for your help.

>>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?

Can you clarify a bit more?

<quote>
So from this point on, how can i use these geographical data, generated by known math equations regarding earth & sun, to create a flat world map with a line separating day & night parts. (if possible a half-shaded area in between to show the transition but this is not indispensable.)

Oh ok, so You need to use some type of GUI to create a flat surface.
Do you know of any?

I have a flat world map. What I want to greate is the "shaded part". which means loads of dots forming some sort of wave (depending on the date it's curves change).

I.E. http://platial.typepad.com/news//Picture%2058_1.png

How do I use all this geographical data to create that shaded part?

As you can imagine it's form changes dramatically throughout the year, so how do I calcula the dots' positions which form it, from the point where I calculate sun rays' position on earth etc.

GUI and programming language is not an issue. C, C#, Java. All is ok. The thing is, what is the logic, algorithm behind creating the very line that forms the shaded part..

<quote>
So from this point on, how can i use these geographical data, generated by known math equations regarding earth & sun, to create a flat world map with a line separating day & night parts. (if possible a half-shaded area in between to show the transition but this is not indispensable.)

Oh ok, so You need to use some type of GUI to create a flat surface.
Do you know of any?

I use the Home Planet program from here http://www.fourmilab.ch/homeplanet/ wich shows what you want. (It is free)
You can download the source code in C.

The boundary region should be approximately the locus of points 1/4 the circumference of Earth away from the perpendicular point. These should be half-way from the opposite-point-on-Earth in any direction. So, you need a Great Circle distance calculation in reverse.

Unit vector at perpendicular point = ((sin lat)(cos long), (sin lat)(sin long),cos lat)

Unit vector at opposite point on Earth = ((-sin lat)(cos long),(-sin lat) (-sin long),-cos lat)

Unit vectors at the boundary will be perpendicular these, so
(x,y,z) dot ((-sin lat)(cos long),(-sin lat) (-sin long),-cos lat) =0
Let (p,q) be some latitude and longitude on the boundary.
(-sin p)(cos q)(-sin lat)(cos long)+(-sin p)(-sin q)(-sin lat)(-sin long)+(-cos p)(-cos lat) = 0
Given any latitude or longitude one should be able to solve for the longitude or latitude of two points on the boundary.

Check my math. I am old and tired...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.