Wheels Within Wheels
- Type
- Graphics
- Category
- GRAPHICS 8 line-pattern generator
- Author
- Jungbo Yang
- Published in
- Antic, April 1984 (Vol. 3, No. 1)
- Year
- 1984
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, Atari BASIC
- Tags
- antic, graphics-8, line-art, trigonometry, patterns, short-program, jungbo-yang, 1984
About the program
Wheels Within Wheels (the program calls itself WHEEL) draws patterns by following a moving point around a circle and joining its positions with straight lines. You choose three numbers. The rotation angle R decides how many lines the pattern has, and two "variation factors", VX and VY, squeeze the circle horizontally and vertically as it goes round. With both factors at zero you get regular shapes:
- R=10 gives a circle of 36 segments.
- R=60 gives a hexagon.
- R=144 gives a five-pointed star.
Any prime number for R gives the maximum of 360 segments. Set VX or VY to something other than zero and, as the article put it, "WHEEL will draw . . . who knows what? Try your favorite numbers and see what happens."
Jungbo Yang, a computer science graduate working for Citicorp in Santa Monica, California, had just bought an Atari 800 and was writing more pattern generators in Forth.
Typing it in
It's plain text with no special characters. The program doesn't check its input, so stay with whole numbers, and R between 0 and 359.
How to use it
RUN it and enter a colour number from 0 to 14 for the screen's hue. Then type R, VX and VY separated by commas, for example 144,0,0, and press RETURN. When the pattern closes, answer Y to MORE? for another, or N to finish. Some combinations you can try, from the article's illustrations: 7,100,200 and 2,300,500.
How it works
DEG(line 400) makesSINandCOSwork in degrees. The centre is at 180,80 on the 320 × 160 GRAPHICS 8 screen, with a radius of 70.- Each step adds R to the angle
INC(line 800). The new point isSIN(INC)andCOS(INC)times 70, each multiplied byABS(SIN(INC*VX))orABS(COS(INC*VY))(lines 900–1000). Those extra factors wobble the radius at a different rate in each direction, which turns a simple polygon into overlapping loops. - Line 1200 stops when the point returns to its starting position at the top of the circle. Because the angle is a whole number of degrees, it always gets back there within 360 steps.
- Line 300 sets the background, border and line colours from the one number you typed, with the lines at brightness 12 on a black-level background.
Variations to try
The article suggests swapping GRAPHICS 8 for the GTIA modes 9, 10 or 11 for colour effects. You'll need to change the centre and radius to fit their 80 × 192 screens, for example CX=40:CY=96 and 35 in place of 70.
Listing
90 REM WHEEL
92 REM BY JUNGBO YANG
94 REM ANTIC MAGAZINE
100 DIM ANS$(1)
200 GRAPHICS 8:? "COLOR [0-14]";:INPUT COL
300 SETCOLOR 2,COL,0:SETCOLOR 4,COL+1,4:SETCOLOR 1,COL,12
400 COLOR 1:CX=180:CY=80:DEG
500 PLOT CX,CY+70:INC=0
600 ? "R,VX,VY";:INPUT ROT,VX,VY
800 INC=INC+ROT
850 IF VX=0 THEN NX=INT(SIN(INC)*70):GOTO 1000
900 NX=INT(SIN(INC)*ABS(SIN(INC*VX))*70)
1000 NY=INT(COS(INC)*ABS(COS(INC*VY))*70)
1100 DRAWTO NX+CX,NY+CY
1200 IF NX<>0 OR NY<>70 THEN 800
1300 ? "MORE? [Y/N] ";:INPUT ANS$
1400 IF ANS$="Y" THEN GOTO 200
1500 GRAPHICS 0
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: WHEEL.BAS.
Credits
- Program listing: Wheels Within Wheels — program listing (Antic, April 1984 (Vol. 3, No. 1)) — Jungbo Yang
- Picture: R=7, VX=100, VY=200, one of the article's examples, being drawn. (Captured from a copy with the answers built in.) — Jungbo Yang (program); screenshot by the site
- Antic, April 1984 - Vol. 3 No. 1: scan of the printed magazine, Wheels Within Wheels, by Jungbo Yang, p. 69 — Erik Wolpaw; Internet Archive, 1984
- Antic disk, April 1984 - Vol. 3 No. 1: WHEEL.BAS (detokenized listing) — Jungbo Yang, 1984
