Trigonometry & Sunset
Not sure whether this question is appropriate on this forum, but very sure there is someone who can answer this. Reason I'm asking this, is that I failed to pay attention in school to anything dealing with sines and cosine stuff, and somehow I think this is the direction I have to look for. So, I'm making this little clock app, in which I want to set the background color to more or less correspond with the amount of sunlight at a given time. It doesn't need to be highly accurate, so, I don't need the real time sun position. The simple reasoning is: At midnight, it is supposedly the darkest hour (black background, 0% white), and at noon, the sun is shining the brightest (white background, 100% white), and everything in between should set the background in an appropriate grey tint. Input to the algorithm is just the hour, ranging from 0 to 24. Thanks in advance. PS, I'm writing the app in Objective-C, but I think the equation will be so simple, that that would be irrelevant.
I guess this is the wrong place for this question (as you as for mathematics, instead of programming). But anyway, this is what you can do (as you seem to wish to work with a sine/cosine): Do the hour *7,5 So 0->0, 12->90, 24->180 As the sin(0)=0, sine(90)=1 and sine(180) = 0, (values 0,90,180 are degrees, not radians). You will get a value ranging from 0-1 with a max at 12 o'clock and a minimum at 0h and 24h. I do not know Objective-C, but i guess it will look something like this: hourdegrees = 7.5 * Input(hour); hourradians = M_PI * hourdegrees / 180; density = sin(hour); M_PI is the call-function for Pi(3.14...) in Objective C Converting degrees to radians: know that 360degrees = 2*Pi radians (see here: Sine to radians Objective-C) Hope you are something with this
estimate angle between two lines y = 1000x and y = 999x
Need help revising a simple formula to make it universal
SWIFT trig functions
2 Different Radians constant calcuations whats the difference?
Trigonometry & Sunset
Calculating collisions with Radians incrementing
How do arbitrary-precision libraries like mpmath evaluate simple trigonometric functions?
How can I calculate the angle
Finding Shortest Distance Between Two Parallel Lines, With Arbitrary Point [closed]
how to convert depth in Z-cordinate
How can I simplify this expression with trigonometric in Maple?
Require trigonometry assistance with ship/wave movement
Trigonometry - Find where two curves intersect
How to calculate point 'along' unit circle radian [closed]
Issues with bullet entry points for “shoulder mounted” guns