Status
Width:
Height:
x0 | |
r | |
k | |
noise |
I think this is a Coupled Map Lattice of the Logistic Map. Either way it's pretty. The logistic map is xn+1 = rxn(xn-1), and in this example, we're representing x as a shade from black=0 to white=1. The twist here is that on each iteration, instead of using the result straight away, it processes the results to add smoothing and then noise. The smoothing step: it takes the pixel itself and the pixels above, below, left and right of it (if they exist), and calculates an average. It then sets the pixel value to k times this, plus 1-k times the value before averaging. Finally, noise is added, by generating a number from 0 to 1, multiplying by noise parameter, and adding that to (1-noise) times the pixel value.
As there are lots of ways to set up the initial values of x, and the various parameters, the contents of each parameter field are passed to eval for evaluation. You can use the variables x and y - these range from 0 to 1, where (0, 0) is the bottom left. Yes, I know, I'm using x for the x-coordinate and also the value of each pixel. Sorry. As well as the standard javascript functions, there is also rnd_gauss() which generates a random number according to a standard Gaussian distribution, and rnd_cauchy() that generates a random number from a Cauchy distribution. Some examples, good for copying and pasting, applicable to various fields, are below. Remember to press Reset after changing the parameters.
Math.random()
x+((1-x)*Math.random()*y)
x
y
3.0+y
3.65
xx = x - 0.5; yy = y - 0.5; Math.random()*Math.sqrt((xx*xx)+(yy*yy))*1.4
Math.random()*x*x*x
4 - (y*y)
Peter Corbett, 2014
Back to ptc24 labs.