25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Online calculator draws random IFS fractal images, or design your own
An Iterated Function System fractal is an image composed entirely of smaller copies of itself. There are an infinite number of them that can be drawn. This online calculator allows you to draw random IFS fractal images with the click of a button. It also allows you to design your own images with a variety of options and view the result.
Width and Height: Set the size of the image. Although you can set these to high values, large images might not draw well. The program imposes a strict limit on the drawing time. When the limit is reached, it returns whatever it has drawn. If an image comes back less filled-in than you expected, the only reliable way to increase the fill density is to reduce the image size. You can increase the DupLimit setting (as described below), but the drawing time limit overrides DupLimit, so a higher DupLimit might have no visible effect.
Color points by: Determines which method to use for coloring each pixel. The available options are:
DupLimit: For the "Monochrome" and "Which transform" coloring methods, DupLimit controls when an image is considered filled-in enough to be finished. To get a less densely filled image, set a lower DupLimit. For a denser fill, set a higher DupLimit. Whenever Width and Height are changed, DupLimit is automatically set to a value that is 5% of the image's area. It's a number that works fairly well even though it does not mean that "5% of the image's pixels have been set".
Color palette: The program uses a palette of 256 colors. You can specify the first few colors, or all of them, by typing or pasting values into the "Colors" text box. The first color is the image background. After loading the colors you provide, the program tops up the palette with random colors. If the Colors textbox is empty, all the colors are random, including the image background.
Image upside down: draws the image with the Y-axis inverted. This is sometimes necessary for human-designed fractals (such as copied from books) that have a definite top and bottom.
Options when generating random sets only:
Each of the above options has three possible values: Yes (Always), No (Never, except maybe by accident), Sometimes (Program chooses randomly). If you want to see images where it is obvious that the fractal consists entirely of smaller copies of itself, set both options to Yes.
Transform set editor text box
This text box allows you to edit or create the raw data that defines a transform set. Text length is limited to 4000 characters. Anything beyond that is removed before the text is submitted to the program.
The first line in the box is the number of transforms in this set. If there are actually more transform lines than this number indicates, the program turns the extra ones into comments and does not use them. Any other text lines are also turned into comments.
The IFS fractal generator program starts with a point in the image, having certain x,y coordinates. It then randomly chooses which of the available transforms (in the set) to use to calculate the x,y coordinates of the next plotted point.
Each of the transforms specifies three different operations that can be done to calculate a new point from the old one. It helps to remember that if you perform these operations on every point in an image, you transform the entire image in that way. Thus, each transform in the set is responsible for drawing one of the smaller copies of the image. This is easiest to see when you use the "Color by which transform plotted it" coloring mode. These are the three possible operations that each transform can define, normally used in combination:
For reasons described somewhat more fully on this related web page, it is pointless to try to design an IFS fractal in rectangular or "IFS" mode. It is only possible to design in "polar" (which I call PFS) mode where you directly specify the values for scaling, rotation, and translation. The editor box provides these column headings as a guide:
xscale yscale xrot° yrot° xtrans ytrans prob
xscale/yscale: The program outputs values between -0.9999 and +0.9999 (fractions of the size of the original image to create the smaller sub-image), but it also accepts as input -99 to +99 (percentages), to allow pasting transform sets from other sources that use whole numbers.
When xscale and yscale are the same, the image is regular and proportional. When the two values are different, you get images that are more wild and irregular.
Scaling values can be positive or negative. When a scaling value is negative, it specifies a reflection, a flip over the axis, which creates a mirror image. A negative xscale flips the image horizontally. A negative yscale flips the image vertically.
xrot/yrot: -359.9999 to 359.9999 degrees by which to rotate the image to create its smaller sub-copy.
When xrot and yrot are the same, it is easiest to see how the whole image consists of smaller copies of itself. When the two values are different, the X and Y axes of the whole image remain at a 90 degree angle to each other, as you'd normally expect, but in the smaller copies they are not. This makes the smaller copies look squished or distorted (as when you turn a plus sign "+" with perpendicular axes into an "X" with skewed axes), but you get a wider variety of types of images.
xtrans/ytrans: How far to move the image along the X and Y axes after scaling and rotating it. The program generates values from -1.0000 to +1.0000, but any numbers between -10000 and +10000 are accepted to allow pasting transform sets from other IFS fractal design programs that use larger numbers.
prob: The probability of this transform being chosen to plot the next pixel. The program accepts values from .0001 to .9999 (1/100th of 1% to 99.99%) or from 1-99 (percent). The exact number 1 is interpreted as 1%. The probabilities for the transform set as a whole must total 1.00 or 100%. If they don't, the program adjusts them automatically. In most transform sets, the probabilities are set to be equal.
You can submit bug reports, feature suggestions, other feedback in the discussion forum.
Copyright ©2012 Steven Whitney. Last modified Sat 08/04/2012 14:22:18 -0700.