The applet below illustrates the construction of a family of lines, called zags because they form alternate lines in a zigzag. Zags are drawn in red. The remaining lines are called zigs and are drawn in black. Full details of the construction are given in an article 'Zigzags' to appear in

In the applet, the Zig angle, Zag angle and Zaglength determine the zigzag,
and the Zig+ etc. buttons add or subtract one degree from the angles. The
number deltaK represents the 'step': if deltaK=1 then every line is drawn,
if deltaK=2 then every

When deltaK=1, the two boxes labelled Zig and Zag operate: a 2 in the zig box suppresses the zig lines altogether (this is the default), a 1 draws them right across the screen, and a 0 draws them their 'natural length' in the zigzag. When deltaK=1 and both Zig and Zag boxes contain a 0 the original zigzag is drawn. Then Zig angle is the angle between successive zigs, Zag angle is that between successive zags, and Zag length is the length of the zags when that of the zigs is 100. The default is for the zigs to be suppressed and the zags to be drawn across the screen (2 and 0 respectively). The Scaling box affects the size of the drawing relative to the screen.

The zags often, as in the Default example, form a highly visible envelope, that is a curve which they appear to be tangent to. We can try to fit a continuous curve, governed by parameters a and c, to this envelope. For the default example a=5 and c=1.The resulting 'whirligig' is drawn in blue, and can be switched on and off via the Envelope box. The whirligig is constructed roughly as follows: a circle is fixed in the plane and another circle moves so that its centre travels round the first circle. The second circle also spins, and carries with it a line whose continuous motion has for its envelope the whirligig. The numbers a and c govern the speed with which the centre moves round the fixed circle and the rate of spin of the moving circle.

Different envelopes of (red) zags require different a and c to make the (blue) whirligig fit. That is one problem addressed in the Mathematics Magazine article. Using the Delay box the zags can be drawn in sequence rather than all together. If you increase the Delay to say 500 (milliseconds) then the zags dance about round the envelope. However, if deltaK=115 you will find that the zags step neatly round the same envelope in the 'correct order'. If (with the default values) you change deltaK to 8 then a completely different envelope appears, and you will find that a=1, c=2 fits correctly. This time no change is needed in deltaK for the lines to step in order round the envelope (try changing the Delay to 500). (Note that the envelope drawing is set up for InitialK = 0.)

Here are some other nice values to use.

- Zig angle = 21, Zag angle = 47, Zag length = 50, deltaK = 1. By changing deltaK to 3 you get one third of the envelope. Use a = 3, c = 1 to get the envelope right and change deltaK to 69 to 'step round'.
- Zig angle = 23, Zag angle = 32, Zag length = 50, deltaK = 1; this needs high values a=17, c=8. To 'step round' use deltaK = 79.
- Zig angle = 20, Zag angle = 46, Zag length = 50. DeltaK = 1 produces 5 circles and deltaK = 5 reduces it to one. Can you find the corresponding a and c? DeltaK = 3 produces a very interesting picture. How many circles do you see?