Posts: 3

Threads: 1

Joined: Aug 2017

Reputation:

**0**
Can anyone explain the math that's going on in these color functions? I am getting the correct number of iterations, r and s values from the resistance function but I am confused on how to compute the rbg values from the iteration number and the threshold number using a cosine/sin wave 'model'.

Posts: 316

Threads: 23

Joined: Jul 2017

Reputation:

**15**
Use the generalized form of sine (and cosine):

y = A sin(fx + d)

where A is the amplitude, f is the frequency, and d is the shift. For blue, as an example, you want the frequency to be such that from 0 to t-1 is one quarter of a cycle. You need to fiddle with pi and such to get the frequency right.