Sine/Cosine wave for sunrise and sunset
I'm working with opengl to create a sunrise and sunset based on the actual times. I'm having trouble coming up with a sin/cos formula that goes from -1 to 1 to -1 for any given sunrise and sunset time with sunrise and sunset obviously equaling -1 and high noon equaling 1.
Your apparent sunrise/sunset depends on your altitude and the altitudes of what's on the horizon (not to mention what's in between you and there).
And then you need an astromony model to determine where the sun is relative to the earth on a specific date at a specific time.