Quasisymmetry

One long-standing interest is the generation of patterns by computer. As an exercise in Java I have developed a program that generates coloured quasi-symmetric patterns under user control. The idea is to generate a set of cosine waves in the plane, the waves being at regular angles to each other. The amplitudes of the waves are summed to form a 3-dimensional pattern. The pattern may be visualised by colouring the bands between contours.

There are a lot of interesting aspects of this process. Comment will come later but, for now, the program is made available below for anybody to experiment with.
Skip to program

The Program Controls

This has to be regarded as an early version with very primitive controls as follows:

Sze(Size): Initially the size is 9 which means that a picture of 512x512 pixels is generated. This is the maximum. If fiddling with slow-to-draw patterns you might like to set the size to 8 or 7.

Sym(Symmetry): Initially this is set to 5 so 5 Sine waves are generated with Pi/5 angle between them. This can be set from 1 to 16. The more waves, the more complex the pattern and the slower the drawing.

CALC(Calculate): This calculates a new pattern and colours in the contours. It also shows the contour of one of the waves (wave 0 - they are all usually the same, but not always)

PIs: This specifies range of arguments that make up the pattern. If PIs is 1 then there is just one iteration of the generating wave. If 4, 2 etc. This is set to 24 initially. This setting may be regarded as a demagnifcation factor, viewing the pattern from a greater distance above the plane.

X and Y: The plane goes on forever. The part that we are looking at is from X, Y to X+2, Y+2 scaled by PIs/2. So, initially with X and Y at -1 we are looking at the 24PI x 24PI region from -12PI,-12PI to 12PI, 12PI. That is, it is centred on the origin. The corrdinates of the lower left corner X and Y may be set to any integer value.

STOP: Should stop the generation process if it is taking too long.

Phs (Phase): Initially the wave form is a cosine. This can be shifted by setting Phs. For example, 90 gives a sine wave. Changing Phs may cause the pattern to lose some of its symmetry.

The upper right controls may be used to change the contouring and colouring. The 12 bars represent the colours to be used and the contour lines. Essentially, the bar on the left is the colour of the bottom region and the bar on the right the colour of the upper region. The overall height of all of the bars is the represents the range of heights in the pattern. The bottom of each bar is a contour line. The region between two adjacent contours is coloured with the colour of the bar on the left. The position of the contours may be changed by dragging the bottom of a bar or clicking on a bar.

CONT: Used to recalculate contours after changing them.

A colour may be selected using the top right controls by either dipping into the limited palette, or typing in the 3 components as integers 0-255. The colour may be allowed to flow down into a contour bar by opening (clicking on) the gate at the top of the bar, the selecting Set.

COLR: Used to recolor the pattern after a colour change in the contours - does not recalculate the contours..

FIX: Normally the contours are renormalised whenever CALC is selected. By selecting FIX this can be skipped so that different sections of the same pattern can be coloured using the same contours.

Spd (Spread): Cosine waves are the default but more interesting patterns can be generated by stranger waves with variable phase shifts. The trick used is to add the sin of the argument to the argument so that the argument receives a variable phase shift. As the sine varies from -1 to +1 the maximum size of the shift is determined by the spread factor (specified in degrees) applied to the sine term.

cos(x + spread* sin(x/repeats) + phase) Rpts (Repetitions): This is the other parameter. We are restricted to waves that (without phase shift) return to synchrony with the cosine, every 2 x rpts PI.

As well as these controls over the wave shape it is possible to apply integer weights to individual waves. An integer weight may be set in the column of weights to the left of the colour setter. Setting some weights to 0 can be interesting. Weights may also be negative which is taken to mean that the wave is reflected around the origin, This can be used to restore symmetry in odd symmetry patterns with phase shift non-zero.

A final trick is that the bottom weight - labeled P - is applied to the previously generated pattern. By setting this to 1, or 2, patterns may be added together to create some interesting variations. The form of wave 0 is shown accurately in this case.


 

Playing Around

You may select to execute one of the programs below. The Mac and PC versions are slightly different because of layout problems (will fix that with swing!) The Java is 1.1. Internet Explorer seems to work better. Note that Internet Explorer on the Mac does not seem to display data entry fields correctly but they still work.

PC version of Pattern Generator

Mac version of Pattern Generator