25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Payments   Humor   Music  

Online calculator draws random IFS fractal images, or design your own

Computer generated IFS fractal
Transform set editor:
 xscale  yscale     xrot°     yrot°  xtrans  ytrans     prob
or
Status messages:
Min=16, Max=2048

pixels
Min=16, Max=2048
Min=1, High values might not be reached
Color points by:


Color palette:
 decimal: R G B
 hex: RRGGBB
In box at right, top color is image background,
Additional colors 1 per row, 256 maximum, in
any mixture of these hex and decimal formats:
Black = #000000 | 000000 | 0 0 0
White = #FFFFFF | FFFFFF | 255 255 255
Green = #00FF00 | 00FF00 | 0 255 0

Options when generating random sets only:
XYSameScale:
XYSameRotation:

Instructions

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.

  1. The easiest way to get started is to click the "Generate random image" button. After a few seconds, the image is displayed, and the numbers that define it are loaded into the "Transform set editor" text box.
  2. You can edit the numbers in the text box and click "Submit Text" to see how the image changes. If the text cannot be interpreted as a valid transform set, error messages are listed in the "Status messages" text box.
  3. To mark a line in the editor as a comment or an unused transform, put a pound sign (#) at the beginning of the line.
  4. You can set various options and settings (described in more detail below) in the large options box.
  5. In the "Transform set editor" box, you can paste the text that defines an IFS image, such as from a book, an online article, or a different fractal generator program, and view its image. You can then change how it's displayed, such as setting its screen size, coloring, etc. to what you want. If you do this and the image looks completely wrong, try changing the calculator from its default "PFS" mode to "IFS" (next to the Submit button). The calculator uses a default numbering system ("polar" or "PFS") that is intuitive to work with when designing fractals. Many other fractal programs use a numbering system ("rectangular" or "IFS") with a file format that looks identical but where the numbers mean completely different things.

Program Options

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:

Monochrome - Uses the same color for all pixels. If you put a list of custom colors in the "Colors" box, the second color in the list is the Monochrome color. Otherwise, a random color is used. (The first color in the "Colors" box is always the image background color.)

Which transform plotted it - Each line (after the first line) in the "Transform set editor" defines an individual "transform" (numeric values for an equation that calculates the x,y coordinates of the next point). This coloring option colors each pixel according to which transform caused it to be set. For example, in a 3-transform set, transform #1 sets pixels in the second color in the Colors box (the Monochrome color), transform #2 sets pixels in the third color, and so on. This coloring option is very useful for seeing how each transform contributes to the overall design of the image.

Number of times hit - After starting at the background color, each hit on a pixel bumps its color one slot up in the palette. This coloring method can produce some of the most beautiful images. With this option, the image is considered finished as soon as any pixel hits the top color (the 256th in the palette).

Program will choose - The program chooses one of the above coloring options at random.

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".

How DupLimit works: As the program sets pixels, it counts how many consecutive points it has hit that had already been hit previously ("consecutive dups"). When a DupLimit of 10,000 is reached, it means that the program set 10,000 consecutive pixels without encountering a single "new" point that was still set to the background color, an indication that the image is becoming fairly well filled in.

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.

In the "Colors" box, you can use any combination of these formats to define the colors:

#0000FF (this example is Blue)
2 hexadecimal digits (00-FF) for Red, then 2 for Green, then 2 for Blue.
For this program, the leading pound sign is optional.
With the pound sign, this format might be familiar to you as a standard way of defining a color in HTML and CSS. The program uses this format internally, and it returns the color list in this format (automatically converting it) regardless of how it was originally entered.

0 0 255 (this example is Blue)
This is a decimal format, one that the popular fractal viewer program Fractint uses for its .MAP color files. Each component (Red Green Blue) is specified as a decimal number between 0 and 255, inclusive, and they are separated by whitespace. 0-255 in decimal format is the same as 00-FF in hexadecimal format.

With either format, any trailing text after the color definition on a line is treated as a comment. The program accepts it but ignores it and returns the list of colors with the comments removed. This feature allows pasting Fractint .MAP files, which tend to have comments on the lines.

For experimenting with custom color palettes, especially gradient palettes for use with the Color By Hits option, I've created an online color palette editor.

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:

XYSameScale: Each randomly generated transform uses the same value for xscale/yscale so the smaller copies are exactly proportional in width and height to the full sized image.

XYSameRotation: Each randomly generated transform uses the same value for xrot/yrot so the X and Y axes remain perpendicular and not skewed or squished in the smaller copies of the image.

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:

You can scale it down, such as to 50% of its original size.

You can rotate it, such as by 90 degrees.

You can translate it, which means to slide it along either the X or Y axis, or both.

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.

For this program, it is the relative size of the translation values that matters. Any two values, with one twice as big as the other, produce the same image regardless of the absolute numbers. A number twice as big as another number specifies a translation of twice the distance. You could use 2 and 4 or .2 and .4 or .02 and .04.

If your xtrans/ytrans numbers exceed the allowable limits, scale them all down by the same amount, such as dividing them all by 10 or 100.

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 use unequal probabilities to adjust the shading: a transform with a higher probability of being chosen gets filled in more densely.

You can also use unequal probabilities to adjust the fill density when one transform defines a much larger area than another. Give the smaller transform (the one with small xscale/yscale values) a small probability of being chosen, and give the larger-area transform (higher xscale/yscale values) a higher probability, to equalize the fill densities of the two regions.

Other notes

  1. When you first visit this page, the displayed image is usually the one left behind by the calculator's previous user. If you prefer that your last image not be displayed to other users, create a random image before ending your session.

You can submit bug reports, feature suggestions, other feedback in the discussion forum.

 

Valid HTML 4.01 Transitional
Yahoo! Search
Search the web Search this site
Valid CSS