Colouring-in: Relaxation

Relaxation

For the relaxation operation we start by making the assumption that a pattern where all the lines are the same length would be the most relaxed.

There are other options like trying to make all the polygons regular, or all the angles at a point equal, but the line length option is the easiest to calculate.

The image on the left is the result of applying this relaxation transformation to the image on the opening page.

First we imagine the pattern to be a collection of balls (the points) joined together by springs (the lines). We then calculate the average line length and assume that this is the optimum. Now we can start calculating the forces on the balls.

If the line is longer than the average then there will be a force pulling the two balls together. This will be proportional to the line length minus the average length. This relation still holds if the line is shorter than the average, but now, because the difference is negative, the force will be pushing the balls appart.

The total force on a ball will be the sum of the individual forces, contributed by the springs the ball is connected to. (Note: this is the vector sum as the forces act along the lines).

Given the forces we can calculate the acceleration on each ball and then use these accelerations to adjust the velocities of the balls (they are assumed to start off stationary).

We then add the velocities to the current positions to calculate the next positions. This is only an approximate algorithm, to calculate the real motion we'd have to solve lots of simultaneous differential equations. As long as we keep the distance moved each iteration small compared to the line lengths it will be accurate enough for our purposes.

The image below left shows the result of one application of the Edge Replacement algorithm on a pentagon with spokes. On the right is an animation showing how the pattern evolves under the relaxation algorithm described above.

This is an interesting animation but it doesn't quite meet our purpose of optimising the line lengths, as once you set the springs in motion they never stop. To get the iterations to converge on a relaxed configuration we need to introduce "drag". Now in each iteration, as well as adding the acceleration to the current velocity we also introduce a drag term, which reduces the previous velocity by a configurable ammount. The next animation shows the effect of reducing the velocity by 20% each iteration. Notice that the pattern settles down quite quickly to a stable arrangement. This will be a minimum energy arrangement given the assumptions at the start of this section.

Spontaneous Symmetry Breaking

This picture is the result of a 1000 iteration relaxation. Note that it has lost the five planes of reflective symmetry. This shouldn't be possible because the original state was symmetrical. It must have happened because the floating point maths used to calculate the next configuration introduces small errors which eventually allow the symmetry to break. It is based on a spoked pentagon with three edge replacements.

Return to the colouring-in index page