# Clifford Attractors

Attributed to Cliff Pickover

Graphics by Paul Bourke
February 2004

Contribution by Paul Richards including source code.

Definition
xn+1 = sin(a yn) + c cos(a xn)
yn+1 = sin(b xn) + d cos(b yn)
where a, b, c, d are variables that define each attractor. a = -1.4, b = 1.6, c = 1.0, d = 0.7 a = 1.6, b = -0.6, c = -1.2, d = 1.6 a = 1.7, b = 1.7, c = 0.6, d = 1.2 a = 1.5, b = -1.8, c = 1.6, d = 0.9 a = -1.7, b = 1.3, c = -0.1, d = -1.2 a = -1.7, b = 1.8, c = -1.9, d = -0.4 a = -1.8, b = -2.0, c = -0.5, d = -0.9

Question: How are the colour effects here achieved?
Answer: The main thing happening here is that I don't draw the attractor to the final image. Rather I create a large grid of 32 bit (int or float) and instead of drawing into that in colour I evaluate points on the attractor and just increment each cell of the grid if the attractor passes through it. So it's essentially a 2D histogram for occupancy. One wants to evaluate the attractor much more/longer than normal in order to create a reasonable dynamic range and ultimately smooth colour gradients. I then save this 2D grid, the process of applying smooth colour gradients comes as a secondary process ... better than trying to encode the right colour during the generation process. One can even just save the grid as a 16 or 32 bit raw, open in PhotoShop and apply custom gradient maps there.
Of course this is "just" a density mapping of the histogram and doesn't immediately allow for colouring based upon other attributes of the attractor path, such as curvature. But such attributes can be encoded into the histogram encoding, for example the amount added to a cell being a function of curvature.