Open MBenoli opened 7 years ago
I realize this is out of the blue, but I wrote such a function in Swift a while back. See https://stackoverflow.com/questions/41656453/suns-position-in-swift. ceeK, if you see this, feel free to add this code to your library, that will save me having to reinvent the wheel.
+1 request for this function.
Surely one can enumerate every single second from this point on for a fixed time range and store them in a linear list. However for a function which requires frequent calls, the memory and computing overhead is unnecessarily large. Is it possible to have a closed form solution/approximation to the sun positions?
Dear Chris,
Here is an example of what I mean: Knowing the latitude, longitude of a location (Let's say: 40.730610, -73.935242 for New York) and knowing the sun angle (for example for the sunset the sun angle is defined as making an angle of -0.833 below the horizon) can I get the time of the sunset for a given date (for example: 6:22 AM on the 12th of July) ?
Of course, here I gave an example for the sunset but I want to get times for different sun angles.
So the call to the function would be like: getTimeForGivenSunAngle(date,lat,long,sunAngle) that will return something like: "In New York, on the 12th of July the Sun will make an angle of -0.833 degrees at 6:22 AM"
Best regards,
Michael