Cosine coloring. (Back) (Root)


A Julia set,

The picture above is from a quadratic Julia set with parameter mu=-0.76845-0.10750i and has an iteration limit of 96. We are going to use it to discuss the cosine coloring algorithm. This article will make a lot more sense if you already understand how the Julia set algorithm works or if you've read this site's the article on Julia sets. I learned about the cosine coloring algorithm from Clifford Pickover's really cool web site.

The different algorithms for all the fractals using complex numbers work by generating a series of points in the complex plane by iterating some formula. In the diagram above the point escaped on its fifth iteration. For every pixel you plot in your image, there is a whole sequence of points like P1, P2, ..., P5 in the diagram above that you looked at while deciding how to treat the point you're about to plot. The cosine coloring algorithm uses the last two points, P4 and P5 in the example above to compute the shading. Treat the points as points in the normal x-y plane. Connect them with a vector running from the next-to-last point to the last point, i.e. P4 to P5. That vector makes an angle with any horizontal line. The intensity of the point plotted is proportional to the cosine of that angle either plus one and then divided by 2 or simply squared. Both these formulas, adding one and then dividing by two or squaring, force the value of cosine into the range zero to one. That zero to one intensity is used to set the intensity of the shade.

In the picture at the top of the page the blue parts are colored with according to the vector joining the last point before escape with the point that is the witness to the escape. The green points are the last two points also, but there is not escape, the algorithm failed to escape and hit the iteration limit. Click on the picture to get a better view.