Illusions

Author(s): Tad Hendrickson
Publication: The Plotter
Pub Details: The Plotter v4 n7-8 (Volume 4, Issue 7-8)
Date: July - August 1986
Pages: 7
  10 FOR A=65510 TO 65521:READ BYTE:POKE A,BYTE:NEXT A
20 FOR A=65522 TO 65533:READ BYTE:POKE A,BYTE:NEXT A
30 LET P2=PI/2:LET SP=P2/9
40 LET EP=SP/5:LET DT=PI/15
50 LET B=1
60 FOR V=1 TO 5
70 CLS:INK 0:PAPER 7:BORDER 7
80 PRINT AT 21,5;"...constructing view#";V
90 LET DP=EP*V
100 FOR I=DP TO PI STEP SP
110 LET A=COS(I)
120 LET FIRST=1
130 FOR T=0 TO PI STEP DT
140 LET X=A*SIN(T)
150 LET Y=B*COS(T)
160 LET PX=X*80+127
170 LET PY=Y*80+87
180 IF FIRST THEN PLOT PX,PY: LET FIRST=0
190 IF NOT FIRST THEN DRAW (PX-(PEEK 23677)),(PY-(PEEK(23678)))
200 NEXT T
210 NEXT I
220 PRINT AT 21,0;" "
230 READ CODE
240 POKE 65512,CODE
250 RANDOMIZE USR 65510
260 NEXT V
270 CLS
280 RESTORE 1020
290 FOR V=1 TO 5
300 READ CODE
310 POKE 65527,CODE
320 RANDOMIZE USR 65522
325 NEXT V
330 GOTO 280
1000 DATA 17,208,0,33,0,64,1,0,24,237,176,201
1010 DATA 17,0,64,33,208,0,1,0,24,237,176,201
1020 DATA 132,156,180,204,228

Transcription note: the listing is corrected so it runs. As printed, line 70 reads INK=0:PAPER=7:BORDER=7, line 190 is missing a closing bracket, and line 330 jumps back before NEXT V so only the first view is shown; corrected to INK 0:PAPER 7:BORDER 7, the bracket added, and 325 NEXT V added (as in the revised printing).

The above program draws five displays of a globe and then saves the screen display into memory. After the displays have been saved the program then brings each of the five displays back on to the screen in succession to give the apperance of a rotating globe.

To change the direction of rotation. these changes are required.

RIGHT ROTATION

130 FOR T=-PI TO 0 STEP DT

ROTATION UP

140 Y=A*SIN(T)
150 X=B*COS(T)

ROTATION DOWN

130 FOR T=-PI TO 0 STEP DT
140 Y=A*SIN(T)
150 X=B*COS(T)

To change the globe size, make changes to lines 160 and 170.

Ex.     160 LET PX=X*40+127
170 LET PY=Y*40+87

It is possible to have more than 5 different dislpays of an object but you must make changes to the position of where the object is. If you are using only two thirds of the screen, it is possible to have 7 different displays of an object. If you use the bottom two thirds of the screen then the sixth number in line 1000 and the third number in line 1010 must be changed to 72. In line 1020, the first number is 132 and then increase it by 16. In lines 1000 and 1010, the number fourth from the end must be change to 16. When using just one third of the screen, it is possible to have 15 different displays. If you use the middle third of the screen, the sixth number in line 1000 and the third number in line 1010 must be changed to 72. If you are using the bottom third, the sixth number in line 1000 and the third number in line 1010 must be changed to 80. In line 1020, then first number is 132 and increases by 8. In lines 1000 and 1010, the number fourth from the end must be changed to 8.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.