Point Set Graphics

Douglas Winsand

Explore an entire universe, move into it, starting from the simplicity of an innocuous mathematical expression. Best of all, you need not understand the underlying mathematics to voyage into these equations, but the explorations might well deepen your appreciation and knowledge of them.

The computer can allow you to see mathematical events, to visualize the often delicate interactions of abstract, mathematical ideas. This program lets you generate, examine, and save pictures of recursive point sets.

These point sets create some very unusual computer graphics when plotted on your screen. You'll see misshapen, reversing spirals, abstract shapes, wisps of smoke, galaxies, and pointillist flowers – all composed of myriads of points. Most of these point structures are very hard to describe, some are quite beautiful. Many of them are also infinitely detailed. This program will turn your computer into a powerful microscope, allowing you to move closer into the detail of the inner structures in some of the point sets you'll generate.

What are recursive point sets? There are an infinite variety of ways to scatter points in a plane. At one extreme is the perfect straight order of points in a line. At the opposite extreme is a totally random scattering of points across the plane. Between these two extremes, there are an infinite number of collections or sets of points in the plane sets which are partially ordered and partially random. These are the point sets you'll be able to create.

The algorithm for generating recursive point sets is really quite simple. We begin with a seed point plotted in the x-y plane. We then plug the x and y coordinates of the seed point into a recurrence formula in order to generate the x and y coordinates of a new point. This new point is then used as the seed point in the recurrence formula to generate a third point and so on, ad infinitum.

A typical recurrence formula is:

X1 = Y - SIN(X)
Y1 = B * X2 + X - 1

where

X1 is the x coordinate of new point

Y1 is the y coordinate of the new point

X is the x coordinate of the seed point

Y is the y coordinate of the seed point

The recurrence formula is the heart of this process. By changing these equations, you can begin to create new recursive point sets.

Running The Program

After you've entered the program (and made the appropriate changes if you use tape), RUN it. First you'll be asked whether you want to create a new point set, or view a point set which you have saved on tape or disk. If you enter a two, and you're using a disk drive, type in the name of the picture file you wish to see. If you are using tape, push PLAY when the computer beeps.

Since you haven't created any point sets yet, enter 1. The recurrence formula (lines 170–190) will be displayed. Type CONT and you'll see the points created by the recurrence formula begin to appear on the screen along with their x and y coordinates. The points will continue to be plotted until you take one of the following actions.

Either type C on the keyboard in order to change the recurrence formula, or type S to save a picture of a point structure which you've generated. When you type S, you'll be asked to supply an eight-character picture file name, if you're using a disk drive. (The computer will beep twice for tape. Push PLAY-RECORD.) The recurrence formula will be displayed in the text window so that you'll know how to create the same set later.

Or, typing M will stop the point set generator and display a flashing point which you can move around the screen with a joystick. Push the trigger on the joystick to freeze the flashing cursor point where it is. At whatever location you freeze the point, this will be the center of the screen when you again begin generating points. Using this feature, you can choose a point of interest and bring it to the center of the screen. While you are moving the cursor, you'll see two numbers displayed in the text window. These are the x and y coordinates of the cursor point. You can use these two numbers as references to specify areas within your point structures.

Magnifying Beyond 100,000 X

Once you've frozen the cursor, you'll be asked to specify a magnification factor. If your point set is too large for the screen, enter a magnification factor between zero and one. The field of view will shrink by the specified amount. If you want to magnify the point set, enter a magnification factor greater than one. A rectangle will appear on the screen. The rectangle encloses an area which will occupy the entire screen when you begin generating points again. I suggest that you start with fairly low magnifications at first, and that you magnify in series of small steps rather than one large magnification. This is simply so that you won't lose sight of where you are in the point set. I've magnified point structures up to 100,000 times with no problem. Somewhere between a magnification of 100,000 and 1,000,000, however, the limited precision of your computer will become evident, and the computer will begin to randomize and destroy the order in your point structure.

After you've selected your magnification factor, you'll be given a choice of whether you wish to begin plotting points, starting with the last point you plotted before you called the magnification routine. I've included this last option to allow you to magnify point sets quickly. If you attempt a high magnification and begin plotting points from the original seed point, it may take a long time before the points begin to appear on the screen. There is also an S option at this point to allow you to save a point set with the magnification rectangle included. That's basically it.

If you let Program 1 run for about five minutes, you'll see a fluid, streamlined structure take shape. This point set is called the attractor of Henon. It turns out that each of the lines of points in the attractor of Henon is actually composed of several parallel lines of points, and each of those several lines of points is composed of several more parallel lines and so on, forever. For more information about attractors, let me refer you to Douglas Hofstadter's excellent article in the November 1981 issue of Scientific American.

To begin to see some of the detail in the attractor of Henon, type M and move the cursor point to (-.55, 0), and then push the joystick trigger. Enter four for the magnification factor and then type B. Again, after about five minutes, you'll see an exploded view of the attractor. You'll also see the lines of points begin to resolve into separate parallel lines.

Generally, the higher the magnification, the longer it will take for a point set to develop a recognizable structure. I've frequently run a point set program for several hours (and sometimes overnight) in order to see more of the detail. Most of these point sets are composed of an infinite number of points, so you'll always see only partially completed sets. The more points in your set, the more it will look like the actual infinite set.

If you're using a cassette recorder, simply make the following changes:

1. eliminate lines 420 and 1160
2. change line 60 to : DIM B\$(8) : M = 80 : PRINT"(up arrow);" : PRINT : PRINT
3. change line 410 to : TRAP 430 : LPRINT
4. change line 450 to : OPEN #2,8,0,"C :"
5. change line 1170 to : OPEN #2,4,0,"C :"
6. change line 1150 to : REM

Explorer's Notes

Now that you know how to generate these point structures, you can begin to explore this strange territory.

As you try different recurrence formula and seed points, you'll find that, more often than not, the point structures your formula generates are divergent sets whose points quickly exceed the screen limits or the computer's numerical limits. If a point set diverges, vary the seed point, or change additive or multiplicative constants in the recurrence formula. Watch to see if one of these changes slows or quickens the divergence. Here is where a little perseverance will be rewarded.

Once you've found a convergent point set, you can usually create slightly different looking sets by making small variations in the same parameters mentioned above. Some of the point structures I've found will metamorphose into a totally different looking pattern when one of the parameters in the recurrence formula is changed. Try every kind of function that Atari BASIC offers. Using subroutines, I have tried Bessel and Legendre functions in some of my recurrence formulae.

The class of point sets which I've discovered most often are the spirals. Most of them slowly converge toward a center point, but I have found several spirals which slowy grow out from a center toward a fixed boundary. I have also run across several spiral structures which look like spiral galaxies.

Other types of point sets I've found are much harder to describe in a few sentences. I've included a few of these in the recurrence formulae in Figure 1. These will help to get you started, and give you an idea of the variety of point sets I've found. I'm sure there are many, many others.

For those of you whose curiosity is piqued, there are many new paths to explore. For example, with a few changes, each new point can be calculated from several preceding points rather than just one, immediately preceding, point. I've done a little experimenting using two preceding points to calculate a third, and I have found some convergent point structures.

For those of you with a printer or a movie camera, a striking animation sequence can be created by changing one of the parameters in the recurrence formula, then recording a picture, changing that same parameter by a small amount, recording a picture, and so on until you've built up about 20 or 30 of these pictures. Place these pictures in order and flip through them rapidly to create an animation effect. I've only had time to create one such sequence, but the effect is worth it. Lines of points appear to twist and writhe, evaporate back to points and later condense into lines again.

The concept underlying these point sets can be extended to three dimensions and, with a short algorithm, you can display these sets on your screen. You can even generate stereoscopic views of three dimensional point structures.

Figure 1

1. X = 0 : Y = 1 X1 = Y + 1.4*X^2.1 Y1 = X^2 - .3*X
2. X = O : Y = .58 X1 = Y + 1.4*X^2.1 Y1 = X^2 - Y^2 + 1
3. X = 1 : Y = .5 X1 = Y - (COS(X)^2)^1.25 Y1 = .01*X^2 - X + 1.125
4. X = 1 : Y = 5 X1 = Y - (COS(X)^2)^1.25 Y1 = .01*X^2 - X + 1.27
5. X = .01 : Y = .001 X1 = 2*Y*SIN(X) - 1 Y1 = 3*(COS(Y) - SIN(X))
6. X = .01 : y = .001 X1 = 1.4*Y*SIN(Y) - X Y1 = 1.4*COS(Y) - .3*SIN(X)
7. X = .75 : Y = .5 X1 = Y - (ABS(COS(X) - SIN(X)))^1.25 Y1 = .01*X^2 - X + 1.5

PROGRAM. Point Set Graphics.

10 REM * RECURSIVE POINT SET UTILITY *
20 REM * DOUGLAS WINSAND – 1982 *
30 REM
40 REM * INITIALIZATION & OPTIONS *
50 REM
60 DIM A\$(15), B\$(8) : A\$ = "D1 : {8 SPACES}. DAT" : M = 80 : PRINT "{CLEAR}" : PRINT : PRINT
70 PRINT "DO YOU WISH TO : "
80 PRINT "{7 SPACES}1) CREATE A POINT SET"
90 PRINT "{7 SPACES}2) VIEW A PREVIOUSLY STO RED SET"
100 INPUT B
110 IF B = 1 THEN 320
120 IF B = 2 THEN 1150
130 F = O : G = O : FLAG = O
140 B\$ = "{8 SPACES}"
150 GRAPHICS 8 : SETCOLOR 2, 0, 0 : COLOR 1 : OPEN # 1, 4, 0, "K : "
160 REM * RECURRENCE FORMULAE *
170 X = 0 : Y = 0 : PLOT X, Y
180 X1 = Y + 1.4 * X ^ 2 - 1
190 Y1 = 0.3 * X
200 REM * PLOT CALCULATED POINTS *
210 C = 159 + (X1 - F) * M : D = 79 + (Y1 - G) * M
220 IF C > 0 AND D > 0 AND C < 319 AND D < 159 THEN PLOT C, D
230 PRINT X1, Y1
240 REM * READ KEYBOARD & BRANCH *
250 IF PEEK(764)< >255 THEN GET #1, J : B\$(1, 1) = CHR\$(J)
260 IF B\$(1, 1) = "S" THEN GOSUB 410
270 IF B\$(1, 1) = "M" THEN GOSUB 570
280 IF B\$(1, 1) = "C" THEN GOTO 320
290 X = X1 : Y = Y1 : GOTO 180
300 REM
310 REM * CHANGE RECURRENCE RELATION *
320 GRAPHICS O
330 PRINT : PRINT : PRINT
340 PRINT "CHANGE THE RECURSION FORMULA, THE N TYPE 'CONT' TO PLOT YOUR NEW POINT SET"
350 LIST 170, 190
360 STOP
370 CLOSE #1 : GOTO 140
380 REM
390 REM * STORE SCREEN ROUTINE *
400 REM
410 PRINT "ENTER 8 CHARACTER NAME OF NEW PIC TURE FILE." : INPUT B\$ : TRAP 410
420 FOR X = 4 TO 11 : A\$(X, X) = B\$(X - 3, X - 3) : NEXT X
430 LIST 170, 190
440 PICMEM = PEEK(88) + 256 * PEEK(89)
450 OPEN #2, 8, 0, A\$
460 FOR J = PICMEM TO PICMEM + 6400
470 IF PEEK(J) = 0 THEN GOTO 490
480 P = (J - PICMEM)/256 : PUT #2, INT(P) : PUT #2, (P - INT(P)) * 256 : PUT #2, PEEK(J)
490 NEXT J
500 PUT #2, 0 : PUT #2, 0 : PUT #2, 0
510 TXTMEM = PEEK(660) + 256 * PEEK(661)
520 FOR J = TXTMEM TO TXTMEM + 159 : PUT #2, PEEK(J) : NEXT J
530 CLOSE #2 : B\$(1, 1) = " " : RETURN
540 REM
550 REM * MAGNIFICATION SUBROUTINE *
560 REM
570 X0 = 159 : Y0 = 79
580 REM
590 REM * FLASHING CURSOR ROUTINE *
600 REM
610 POSITION X0, Y0 : PUT #6, 1 : H = STICK(O)
620 IF STRIG(O) = 0 THEN GOTO 790
630 IF H< >15 THEN GOSUB 710
640 IF X0 > 319 THEN X0 = X0 - 1
650 IF X0 < 0 THEN X0 = X0 + 1
660 IF Y0 > 159 THEN Y0 = Y0 - 1
670 IF Y0 < 0 THEN Y0 = Y0 + 1
680 POSITION X0, Y0 : PUT #6, 0
690 FOR L = 0 TO 30 : NEXT L
700 GOTO 610
710 POSITION X0, Y0 : PUT #6, 0
720 IF H = 6 OR H = 10 OR H = 14 THEN Y0 = Y0 - 1
730 IF H = 5 OR H = 13 OR H = 9 THEN Y0 = Y0 + 1
740 IF H = 6 OR H = 7 OR H = 5 THEN X0 = X0 + 1
750 IF H = 9 OR H = 10 OR H = 11 THEN X0 = X0 - 1
760 PRINT "{CLEAR}"
770 PRINT INT((X0 - 159 + M * F)) / M, (-1) * INT((Y0 - 79 + M * G)) / M
780 RETURN
790 F = (X0 - 159 + M * F) / M
800 G = (Y0 - 79 + M * G) / M
810 REM
820 REM * MAGNIFICATION ROUTINE *
830 REM
840 PRINT "ENTER MAGNIFICATION FACTOR" : INPUT N
850 IF N < 1 THEN GOTO 990
860 P1 = X0 - 159 / N : P2 = X0 + 159 / N : P3 = Y0 - 79 / N : P4 = Y0 + 79 / N
870 IF P2 > 319 AND P3 < 0 THEN PLOT P1, 0 : DRAWTO P1, P4 : DRAWTO 319, P4 : GOTO 990
880 IF P1 < 0 AND P3 > 0 THEN PLOT P2, 0 : DRAWTO P2, P4 : DRAWTO 0, P4 : GOTO 990
890 IF P1 < 0 AND P4 > 159 THEN PLOT 0, P3 : DRAWTO P2, P3 : DRAWTO P2, 159 : GOTO 990
900 IF P2 > 319 AND P4 > 159 THEN PLOT 319, P3 : DRAWTO P1, P3 : DRAWTO P1, 159 : GOTO 990
910 IF P1 < 0 THEN PLOT 0, P3 : DRAWTO P2, P3 : DRAWTO P2, P4 : DRAWTO 0, P4 : GOTO 990
920 IF P3 > 0 THEN PLOT P1, 159 : DRAWTO P1, P4 : DRAWTO P2, P4 : DRAWTO P2, 0 : GOTO 990
930 IF P4 > 159 THEN PLOT P1, 159 : DRAWTO P1, P3 : DRAWTO P2, P3 : DRAWTO P2, 159 : GOTO 990
940 IF P2 > 319 THEN PLOT 319, P3 : DRAWTO P1, P3 : DRAWTO P1, P4 : DRAWTO 319, P4 : GOTO 990
950 PLOT P1, P3 : DRAWTO P2, P3 : DRAWTO P2, P4 : DRAWTO P1, P4 : DRAWTO P1, P3
960 REM
970 REM * OPTIONS *
980 REM
990 B\$(1, 1) = " "
1000 PRINT "IF YOU WISH TO RESUME THE RECURSION WHERE IT LEFT OFF PUSH 'R'."
1010 FOR L = 0 TO 500 : NEXT L
1020 PRINT "IF YOU WISH TO START THE RECURSION FROM THE BEGINNING, PUSH 'B'."
1030 FOR L = 0 TO 500 : NEXT L
1040 PRINT "IF YOU WISH TO SAVE THIS PICTURE PUSH 'S'."
1050 FOR L = 0 TO 500 : NEXT L
1060 IF PEEK(764)< >255 THEN GET #1, J : B\$(1, 1) = CHR\$(J)
1070 IF B\$(1, 1) = "R" THEN M = M * N : GRAPHICS 8 : SETCOLOR 2, 0, 0 : RETURN
1080 IF B\$(1, 1) = "B" THEN M = M * N : POP : GRAPHICS 8 : SETCOLOR 2, 0, 0 : GOTO 170
1090 IF B\$(1, 1) = "S" THEN FLAG = 1 : GOSUB 410
1100 IF FLAG = 1 THEN FLAG = 0 : GOTO 1000
1110 GOTO 1060
1120 REM
1130 REM * RECALL STORED PICTURES *
1140 REM
1150 PRINT "ENTER 8 CHARACTER PICTURE FILE NAME" : INPUT B\$
1160 FOR X = 4 TO 11 : A\$(X, X) = B\$(X - 3, X - 3) : NEXT X
1170 OPEN #2, 4, 0, A\$
1180 GRAPHICS 8 : COLOR 1 : SETCOLOR 2, 0, 0
1190 PICMEM = PEEK(88) + 256 * PEEK(89)
1200 GET #2, J : GET #2, K : GET #2, L
1210 IF J = 0 AND K = 0 AND L = 0 THEN 1230
1220 POKE J * 256 + K + PICMEM, L : GOTO 1200
1230 TXTMEM = PEEK(660) + 256 * PEEK(661)
1240 FOR X = TXTMEM TO TXTMEM + 159 : GET #2, J : POKE X, J : NEXT X
1250 CLOSE #2
1260 GOTO 1260