Tutorial: Karakusa Ellipses Coloring

Text and Images © 2009 Kerry Mitchell

Introduction

This coloring was inspired by the tiling work of Asao Toklo. The objective is to create a set of tiles which are randomly placed on the image, creating a pattern of smooth, random arcs.

Of course, Toklo designs his tiles with much more flexibility thaan can be implemented in a single coloring routine. So, this formula seeks to balance flexibility and control with ease of use. The basic idea is:

1. Determine how many tiles you want to use.
2. For each tile, set the number of arcs and the geometric parameters for each arc.
Once the tiles have been created, they are placed in the image window, rotated and flipped.

Parameters

The parameters are in three groups: general, those for each tile, and those for each arc.

General parameters

• # tiles: The number of tiles, from 1 to 10.
• random tile: Check to randomly vary which tile is used in a particular square; clear to set which tile is used in all squares.
• rotate: How the tile is rotated in a square. Choose from none, 90, 180, 270 degrees, or random.
• flip: How the tile is flipped in a square. Choose from none, horizontal, vertical, both, or random.
• thickness: The thickness of the arc. Pixels outside of the arc will be colored with the solid color.
• seed: The random number seed.

Tile parameters (for each tile)

• # ellipses: The number of 'elliptical' arcs, from 1 to 10.
• weight: The weight given to this tile when 'random tile' is checked. Use a larger number to have this tile show up more frequently and a smaller number for less frequent. The minimum is 0. This parameter is only visible when 'random tile' (General parameters) is checked.

Ellipse parameters (for each ellipse on a tile)

• center: The real and imaginary coordinates of the center of the ellipse. Typically, this will be a corner (either (0,0), (1,0), (1,1), or (0,1)) of the base square or the center of a side ((0.5,0),(1,0.5), (0.5,1), or (0,0.5)).
• horizontal axis: Horizontal distance from the center to the edge of the ellipse, 0 or greater.
• vertical axis: Vertical distance from the center to the edge of the ellipse, 0 or greater.
• power: Affects the shape of the arc. True ellipses have a power of 2. Using 1 will make a straight line instead of a curve. Large values (e.g., 100) make essentially a sharp corner.
• drawing order: the order in which the arc is drawn, useful when you have overlapping arcs. 1 is the first (bottom) and 10 is the last (top).

Hints

You are, of course, free to use this coloring however you’d like. However, these hints may help your explorations be more productive.

• This is one of those coloring formulas that does all the work. It was designed to be used as an outside coloring with the “Pixel” formula in lkm.ucl.
• Because of the potentially large numbers of parameters, some design work is useful before diving into the parameters.
• To design a tile, try this:
• Clear 'random tile' in the General parameters and enter into 'which tile' the number of the tile you're designing.
• Set 'rotate' and 'flip' both to 'none'.
• Make the image square (e.g., 500 x 500 pixels).
• On the location tab, set the Center to 3.5/3.5, the Magnification to 4, and the rotation to 0. This will give you a window with just the one tile in which you're interested.
The coordinates of the tile are:
• (0,0) is the lower left corner
• (1,0) is the lower right corner
• (1,1) is the upper right corner
• (0,1) is the upper left corner
• I like to use a two-part black/white gradient, but you can use regular gradients just fine.

Sample Image

Here’s how to make the image at the top of this page.

Step 1: Start a new fractal, with these characteristics:

• Location: center of (3.5, 3.5), magnification of 4, rotation 0, stretch 1, skew 0
• Mapping: none (default)
• Formula: “Pixel” from lkm.ufm, with the default settings.
• Inside: none (default)
• Outside: “Karakusa Ellipses” from lkm3.ucl, with the default settings. Clear the “Repeat Gradient” box and set the Solid Color to white (255 red, 155 green, 155 blue).
• Image: set both width and height to the same value (e.g., 500 pixels).
• Gradient: remove all the control points. Insert one at position 0, color black (0 red, 0 green, 0 blue). Insert a black one at position 200, a white one (255 red, 255 green, 255 blue) also at 200, and a white one at 399. You should see that the left half of the gradient is black and the right half is white. The black will be the center of the arcs and the white will give a border region when arcs overlap.

Your image might not look like much, but it should resemble the “Step 1” image, below.

The default settings are the same for the horizontal and vertical axes of both ellipses. This makes them circles. You can change the oblong-ness of the ellipses by changing the axis values, from 0 up. If you use values larger than 1 then the arc will extend outside of the square. Really large values (like 1000) will make arcs so long that they are indistinguishable from straight lines. This can be helpful.

This is a good time to investigate the 'power' parameter. Regulation ellipses have a power of 2 (from the equation (x/a)2 + (y/b)2 = 1). A generalization of this is, |x/a|power + |y/b|power = 1. When the power = 1, the curved ellipse is replaced by four straight lines, forming a diamond. As the power increases from 2, the ellipse fills out to eventually become a rectangle. Play with the powers of both ellipses and see what happens.

 Step 1 Step 2 Step 3
Sample Image, Steps 1 and 2

Step 2: Create the first tile

1. undo any explorations you did and get back to the Step 1 image. (Or, click 'Reset Parameters' on the Outside tab.)
2. Increase the '# ellipses' to 10.
3. Set the centers and axes of the 10 ellipses to these values (everything else can stay the default value):
 Ellipse Center Horizontal Axis Vertical Axis 1 0/0 0.1 0.1 2 0/0 0.3 0.3 3 0/0 0.5 0.5 4 0/0 0.7 0.7 5 0/0 0.9 0.9 6 1/1 0.1 0.1 7 1/1 0.3 0.3 8 1/1 0.5 0.5 9 1/1 0.7 0.7 10 1/1 0.9 0.9

Your image should look like “Step 2” above.

Now we can look at the 'drawing order' parameter. Change the 'thickness' (General parameters) to 0.2. You'll notice that the arcs centered at 1/1 (the upper right corner) take over the image. Of the arcs centered at 0/0 (the lower left corner), the smallest two (arcs 1 and 2) are visible, the middle one (#3) is partially visible, and the last two (#4 and #5) are almost completely hidden. This is because the arcs are 'drawn' in order and, if they overlap, only the last ones (those on top of the stack) are visible. Once you've entered all the parameters, if you decide that you want #1 on top instead of #10, you don't need to rearrange the parameters, just change the 'drawing order'. The default is that arc #1 is drawn first (on the bottom) and #10 is drawn last (on the top). To change that, just put different values (positive integers) into the 'drawing order' parameter. To test this, change the 'drawing order' of arc #5 to 10 and that of arc #10 to 5. If you don't notice a difference, toggle control-z and control-y to undo and redo the changes.

Step 3: Add more tiles.

This image uses four different (but similar) tiles, so we need to add three more.

1. Get back to the Step 2 image.
2. Set “# tiles” to 4.
3. For each tile, set "# ellipses" to 10.
4. Set the centers and axes to these values (everything else can stay the default value):
 Tile 2 Ellipse Center Horizontal Axis Vertical Axis Drawing Order 1 1/0 0.1 0.1 10 2 0/0 0.3 0.3 1 3 0/0 0.5 0.5 2 4 0/0 0.7 0.7 3 5 1/0 0.9 0.9 9 6 0/1 0.1 0.1 8 7 1/1 0.3 0.3 4 8 1/1 0.5 0.5 5 9 1/1 0.7 0.7 6 10 0/1 0.9 0.9 7

The red cells show where Tile 2 is different from Tile 1--the four outermost arcs (1, 4, 6, and 10) have had their centers rotated 90 degrees. The drawing orders are also rearranged to highlight these arcs.

 Tile 3 Ellipse Center Horizontal Axis Vertical Axis Drawing Order 1 0/0 0.1 0.1 1 2 1/0 0.3 0.3 10 3 0/0 0.5 0.5 2 4 1/0 0.7 0.7 9 5 0/0 0.9 0.9 3 6 1/1 0.1 0.1 4 7 0/1 0.3 0.3 8 8 1/1 0.5 0.5 5 9 0/1 0.7 0.7 7 10 1/1 0.9 0.9 6

In Tile 3, arcs 2, 4, 7, and 9 have rotated centers.

 Tile 4 Ellipse Center Horizontal Axis Vertical Axis Drawing Order 1 0/0 0.1 0.1 1 2 0/0 0.3 0.3 2 3 1/0 0.5 0.5 10 4 1/0 0.7 0.7 3 5 0/0 0.9 0.9 4 6 1/1 0.1 0.1 5 7 1/1 0.3 0.3 6 8 0/1 0.5 0.5 9 9 1/1 0.7 0.7 7 10 1/1 0.9 0.9 8

Finally, in Tile 4, just the center two arcs (3 and 8) are rotated.

5. Check 'random tile' in General parameters.
6. Set 'rotate' and 'flip' both to 'random'.
7. Set the 'thickness' to 0.2.
8. On the Location tab, set the Center to 0/0 and the Magnification to 0.5. Your image should resemble Step 3, above.

Step 4: Location, Location, Location

The Step 3 image doesn't look very random down the left side and across the bottom. If you check the coordinates on the Location tab, you'll see that the Left Top (Re) is -4 and the Right Bottom (Im) is -4. This coloring uses the trunc() function, which is a bit inconsistent around 0 (either Re or Im). Consequently, you'll want to keep the Center such that the entire window is in positive territory for both the Re and Im parts of the coordinates. Move it around to get something that you like; the image at the top of this page has its center at 18/21, Magnification of 0.3535 and a Rotation Angle of 45.

One last thing to investigate is the 'weight' parameter. When 'random tile' is checked in General parameters, the 'weight' parameter appears for each tile. This determines how often this tile is used in the overall image. By default, all the weights are set to 1, which means that each tile has an equal chance of being used. Use higher numbers to use a tile more often, smaller for less often. Set 'weight' to 0 to not use a tile at all. For example, if you change the weight for Tile 1 to 10, leaving the rest of the weights the same, then almost all of the squares will have the Tile 1 pattern. Change the weight to 100 and, for this view, all of the tiles will be Tile 1.

I hope you have fun with this, and be sure to share your creations with the rest of us!

Back to Tutorials page