## Tutorial: General Paired Dissection Coloring

Text and Images © 2004 Kerry Mitchell

### Introduction

This routine is an extension of my Similar Paired Dissection (SPD) coloring. That one allows you to dissect squares and isosceles right triangles into more squares and isosceles right triangles. Here, there's no such restrictions on the shapes, so you can dissect general quadrilaterals and triangles into other general quadrilaterals and triangles. Being more general, it will do everything the SPD will do. Being more powerful, it comes with a slightly steeper learning curve.

### Background

Mathematically speaking, a dissection is when a shape is broken into smaller pieces, in such a way that there are no overlaps and no gaps. There are infinitely many ways in which quadrilaterals (polygons with four sides) and triangles can be dissected into smaller copies of either or both. A few examples are shown in Figure 1.

Figure 1: Examples of Dissections

Each shape can broken into small versions of both shapes. Then, each of those shapes can be further dissected, and so on, leading to a fractal tessellation. That’s what this formula does.

There are four types of dissections that can be created, depending on with which shape you start and how you want to dissect it: triangle to triangle, triangle to both, quadrilateral to quadrilateral, and quadrilaeral to both. In any case, you need a starting point, which is the axiom. That can be either a triangle or a quadrilateral. Then, you need one or two generators (two for either “to both” dissection type). A generator defines how the shapes are dissected into smaller shapes.

Perhaps the best way to use this coloring is to first design your dissection on a piece of graph paper. For an example, let’s look at a variation of the first image in Figure 1. We begin with a square (the quadrilatera axiom) that is divided into four quadrilaterals. Instead of having the middle dividing lines be vertical and horizontal, let's make them at angles, shown in Figure 2. We need to be able to specify the corner points of the sub-shapes, but none of them are squares, so we can't use the coordinates of the corners like in the Similar Paired Dissection coloring. Instead, a list of key points is created, and the sub-shape corners are taken from points on that list.

Figure 2: Generator Key Points

There can be up to 20 key points for both the triangle and quadrilateral generators, plus a special point. The first three or four are the triangle or quadrilateral (respectively) axiom's corner points. From these, you can specify the others. Each subsequent key point is on a line between two previous points. For example, in Figure 2, the points labeled 1 - 4 are the four axiom corner points. Point 5 is on the line from point 1 to point 5, 10% of the way along. Point 6 is 20% of the way from point 2 to point 3; point 7 is 40% of the way from point 3 to point 4, and point 8 is 30% of the way from point 4 to point 1. By specifying the key points in this way, they can consistently be determined when the quadrilaterals change shape in later iterations. In the center of the figure is a point labeled, "0." Point 0 is always available, and is the average of the three or four corner points.

Now that the list key points havs been created, the sub-shapes can be defined by list the key points that make up their corners. For example, the upper-left sub-shape in Figure 2 has key points 0, 7, 4, and 8 as its corners. Another important consideration is the ordering of the sub-shape corner points. They need to be entered in a particular order, (although the order of the sub-shapes for each generator is irrelevant). that being counter-clockwise. This keeps all the sub-shapes from having sides that cross and from turning inside-out. The point is chosen to be the first point may matter greatly to the final image. Consider the example of Figure 2:

Figure 3: Various Layouts of the same Dissection

In each case, the original square is broken down into four non-symmetric quadrilaterals. The red dots indicate the location of the first corner of the axiom, and the black dots mark the first corner of the sub-shapes. In the first case, each of the sub-shapes has its first corner in the corresponding corner of the axiom. In the second case, the first corner is in the middle. In the third and fourth cases, it's the axiom's first corner that has changed; the sub-shape corners are the same as in the first two cases. The effects of the layout changes are shown in Figure 4. Each panel is the fourth iteration of the corresponding generator shown in Figure 3.

Figure 4: Fourth Iteration of Various Quadrilateral Dissections

It pays to map your design out before entering the parameters, and it also pays to be flexible and try rotating the corner points around to see what happens.

### Parameters

To keep track of all the corner points and sub-shapes, this formula has many parameters. However, they are grouped for ease of use, and many parameters are not visible unless they are needed.

General parameters: Overall settings, independent of the specifics of the dissections.

• # iterations: How many iterations to perform; at least 0.
• minimum size: The smallest size of a sub-shape that will be dissected in the next iteration. Set to 0 to dissect all the shapes.
• print smallest: Check this box to print the size of the smallest sub-shape in the current iteration to decide how to set the “minimum size” parameter.
• how much memory: Set this to be at least the number from the “print memory” diagnostic. More shapes means more memory; fewer shapes frees up memory for other things.
• print memory: Check this box to have the coloring tell you what to put in the “how much memory” parameter.
• color by: How to color the image. The choices are:
• outline: Draws the outline of each shape. The shapes are filled with the solid color.
• shape number: Colors by the number of each shape, which reflects the order in which they were created.
• shape size: Colors by the size of each shape.
• shape type: Colors each triangle with color 0 and each square with color 399. Clear the “Repeat Gradient” box when using this mode.
• line thickness: The thickness of the line when coloring in the “outline” mode; only visible in that mode.
• speedup threshold: If the pixel is further than this distance from the line, it won’t be checked against the line for coloring purposes. Generally, set it a bit larger than the longest side that will be drawn.
• print speedup: Check this box to print the longest side in the current iteration, so you know how to set the “speedup threshold” parameter.

Axiom parameters: Settings for the triangle and/or quadrilateral axioms, depending on the “dissection type” choice.

• dissection type: How the original shape is to be dissected. The choices are:
• triangle -> triangle: An initial triangle is dissected only into triangles. No square axiom or generator parameters are displayed.
• triangle -> both: An initial triangle is dissected into triangles and quadrilaterals. Both triangle and quadrilateral axiom and generator parameters are displayed.
• quad -> both: An initial quadrilateral is dissected into triangles and quadrilaterals. Both triangle and quadrilateral axiom and generator parameters are displayed.
• Triangle axiom: The coordinates of the three corner points of the triangle axiom, if used.
• corner 1 (Re, Im): Complex coordinates of the first corner.
• corner 2 (Re, Im): Complex coordinates of the second corner.
• corner 3 (Re, Im): Complex coordinates of the third corner.
• Quadrilateral axiom: The coordinates of the four corner points of the quadrilateral axiom, if used.
• corner 1 (Re, Im): Complex coordinates of the first corner.
• corner 2 (Re, Im): Complex coordinates of the second corner.
• corner 3 (Re, Im): Complex coordinates of the third corner.
• corner 4 (Re, Im): Complex coordinates of the fourth corner.

Generator parameters: Settings for the triangle and/or quadrilateral generators, depending on the “dissection type” choice.

• Triangle generator: Parameters describing how each triangle is dissected, if needed.
• # key points: How many key points are needed for the triangle generator. The minimum is three (the corners) and the maximum is 20. For each key point beyond 3, the following parameters will appear:
• beginning endpoint: The key point that forms the first end of the line on which the current key point will lie.
• ending point: The key point that forms the second end of the line on which the current key point will lie.
• fraction along: How far along the line the current key point will be, as a fraction and from the beginning endpoint. For example, 0.25 means 25% of the way along the line.
• # sub shapes: How many sub-shapes each triangle will be broken into. The minimum is two and the maximum is 20. For each sub-shape, the following parameters will appear:
• corner 1 index: key point index for first corner.
• corner 2 index: key point index for second corner.
• corner 3 index: key point index for third corner.
• corner 4 index: key point index for fourth corner, if the sub-shape is a quadrilateral. Otherwise, this parameter is not shown.
• Quadrilateral generator: Parameters describing how each quadrilateral is dissected, if needed.
• # key points: How many key points are needed for the quadrilateral generator. The minimum is four (the corners) and the maximum is 20. For each key point beyond 4, the following parameters will appear:
• beginning endpoint: The key point that forms the first end of the line on which the current key point will lie.
• ending point: The key point that forms the second end of the line on which the current key point will lie.
• fraction along: How far along the line the current key point will be, as a fraction and from the beginning endpoint. For example, 0.75 means 75% of the way along the line.
• # sub shapes: How many sub-shapes each triangle will be broken into. The minimum is two and the maximum is 20. For each sub-shape, the following parameters will appear:
• corner 1 index: key point index for first corner.
• corner 2 index: key point index for second corner.
• corner 3 index: key point index for third corner.
• corner 4 index: key point index for fourth corner, if the sub-shape is a quadrilateral. Otherwise, this parameter is not shown.

### 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.
• Design your dissection beforehand. This coloring doesn’t respond well to random mashing of buttons and tweaking of knobs.
• The counter-clockwise ordering of points is important for the coloring to work properly.
• When beginning, use the “outline” coloring mode, with a relatively small line thickness (about 0.01 should work). I typically use either a solid black gradient or a black to white ramp, with the “Repeat Gradient” box cleared. Set the solid color to white. This will help you see the shapes more easily.
• Iteration 0 will show you the axiom, and iteration 1 will show you the (first) generator, to help you verify your layout.
• More iterations means more memory and much more time. Iteration 8 can take days (literally) for a reasonable-sized image. Tread lightly with more than 3 or 4 iterations until you have some idea of what you’re doing. Use the diagnostics to know how much memory to allocate and how to use the speedup factor.
• If you’re doing many iterations, then you may want to set the “minimum size” to something like 0.001 or so. This will stop small shapes from being dissected, which will reduce the amount of memory used and will keep the shapes from turning into solid lines on your image.
• Checking or clearing the diagnostic boxes will cause that layer to start calculating again, so be careful with them if you ‘re working on a complex image. If you don’t see the messages when checking the box, reload the coloring.

### Sample Image

 Final Image (click for parameters) 1 Iteration
Figure 5: Sample Image

This image dissects each triangle into four more. The axiom only occupies the lower left half of the image, so each layer is rotated 180 degrees to take up the other half.

Here’s how to make it.

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

• Location: center of (1, 1), magnification of 2, rotation 0, stretch 1, skew 0
• Mapping: none (default)
• Formula: “Pixel” from lkm.ufm, with the default settings.
• Inside: none (default)
• Outside: “General Paired Dissection” from lkm3.ucl, with the default settings. Clear the “Repeat Gradient” box and set the Solid Color to white (255 red, 255 green, 255 blue).
• Layers: change the layer name to “Layer 1.” Merge mode Difference, opacity 100%.
• Image: set both width and height to 300 pixels.
• Gradient: remove all the control points. Insert one at position 0, color black (0 red, 0 green, 0 blue). Insert one at position 399, color white. Make sure that the “Smooth Curves” gradient mode is on.

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

 Step 1 Step 2
Figure 6: Sample Image, Steps 1 and 2

Step 2: Create the basic dissections

• In the “General parameters” section on the Outside tab, set (all are defaults except the first):
• # iterations: 1
• minimum size: 0
• print smallest: cleared
• how much memory: 100
• print memory: cleared
• color by: outline
• line thickness: 0.01
• speedup threshold: 1
• print speedup: cleared
• In the “Axiom parameters” section, set the “dissection type” to “triangle -> triangle.” Here are the corner point data for the triangle axiom:
• corner 1 (Re/Im): 0/0
• corner 2 (Re/Im): 2/0
• corner 3 (Re/Im): 0/2
• In the “Triangle generator” section, set “# key points” to 6 and "# sub-shapes" to 4. Here are key point data:
• key point 4: begining 1, ending 2, fraction along 0.5
• key point 5: begining 2, ending 3, fraction along 0.5
• key point 6: begining 3, ending 1, fraction along 0.5
• Here are sub-shape data:
1. type: triangle, indexes 5, 3, 6
2. type: triangle, indexes 5, 6, 1
3. type: triangle, indexes 5, 1, 4
4. type: triangle, indexes 5, 4, 2

Your image should look like “Step 2” in Figure 6.

Step 3: Expand.
Add nine more layers (Layer 2 through Layer 10). Set their general parameters and Rotation Angle (Location tab) like this:
 Layer # iterations how much memory line thickness Rotation Angle 1 1 4 0.256 0 2 1 4 0.256 180 3 2 16 0.128 180 4 2 16 0.128 0 5 3 64 0.064 0 6 3 64 0.064 180 7 4 256 0.032 180 8 4 256 0.032 0 9 5 1024 0.016 0 10 5 1024 0.016 180

Step 4: Finish.
Add one more layer by duplicating Layer 10. Copy the Inside coloring (None) to the Outside tab and change the Outside Solid Color to white (255, 255, 255). When you've finished, your image should look like the "Final Image" in Figure 5. If not, review your steps, or just click on the Final Image to see the parameters.

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

Back to Tutorials page