Draw a colored Pickover popcorn fractal in C#


The example Draw a Pickover popcorn fractal in C# explains how to draw the basic Pickover popcorn fractal by iterating these equations:

    Xn+1 = Xn - h * Sin(Yn + Tan(3 * Yn))
    Yn+1 = Yn - h * Sin(Xn + Tan(3 * Xn))

This program plots each point in color. When it starts a new series of points, the program loops through the colors red, green, and blue.

To plot a point, the program looks at the pixel’s color and moves its red, green, or blue component halfway between its current value and the “full on” value 255. For example, suppose the program is plotting a green series of points and finds a pixel with red, green, and blue components 128, 128, and 0. Because this is green series, it would leave the red and blue components unchanged and update the green component to be halfway between its current value 128 and 255 or (128 + 255) / 2 = 383 / 2 = 191. The result is the color with RGB components 128, 191, 0.

Over time points that are hit many times by the same color become saturated. Points that are hit many times by different colors become close to white.

Experiment with the program’s parameters. For example, if you set h = 0.01, iterations = 100, and dx = 10, you get the following image:


Download Example   Follow me on Twitter   RSS feed   Donate

This entry was posted in algorithms, drawing, fractals, graphics, mathematics and tagged , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.