Home » Archimedes archive » Acorn User » AU 1997-02 B.adf » Regulars » StarInfo/circles/Jeffs/Tilt

StarInfo/circles/Jeffs/Tilt

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1997-02 B.adf » Regulars
Filename: StarInfo/circles/Jeffs/Tilt
Read OK:
File size: 04CA bytes
Load address: 0000
Exec address: 0000
File contents
   10REM  Acorn User circle challenge
   20REM  Tilt - by R W Jeffs
   30:
   40MODE 27:OFF
   50DIM cx%(15,1),cy%(15,1),cr%(15,1)
   60L%=0:            REM orbits x 15
   70D%=800:          REM distance of orbit from viewer
   80R%=300:          REM radius of orbit
   90T%=FNtilt:       REM tilt of orbit
  100F%=1024:         REM 3D perspective
  110mx%=640:my%=480: REM centre of screen
  120step%=3:         REM angle increase per step
  130:
  140PROCcols
  150angle%=0:I%=0:L%=0
  160REPEAT
  170 J%=I%-15:IF J%<0 J%+=16
  180 GCOL0,0:CIRCLE cx%(J%,0),cy%(J%,0),cr%(J%,0):CIRCLE cx%(J%,1),cy%(J%,1),cr%(J%,1)
  190 PROCcircle(0,angle%):PROCcircle(1,angle%)
  200 WAIT
  210 I%+=1:IF I%=16 I%=0
  220 angle%+=step%
  230 IF angle%>=360 angle%=0:T%=FNtilt
  240UNTIL FALSE
  250END
  260:
  270DEF PROCcircle(C%,angle%)
  280LOCAL W%,X%,Y%,Z%,col%
  290IF C%=0 THEN
  300 col%=(COS(RAD(angle%))+1)/2*14+1
  310 Z%=COS(RAD(angle%))*R%+D%
  320 W%=20/Z%*F%
  330 X%=SIN(RAD(angle%))*R%/Z%*F%+mx%
  340 Y%=COS(RAD(angle%))*T%/Z%*F%+my%
  350ELSE
  360 col%=(SIN(RAD(angle%))+1)/2*14+1
  370 Z%=SIN(RAD(angle%))*R%+D%
  380 W%=20/Z%*F%
  390 X%=SIN(RAD(angle%))*T%/Z%*F%+mx%
  400 Y%=COS(RAD(angle%))*R%/Z%*F%+my%
  410ENDIF
  420GCOL 0,col%
  430CIRCLE X%,Y%,W%
  440cx%(I%,C%)=X%:cy%(I%,C%)=Y%:cr%(I%,C%)=W%
  450ENDPROC
  460:
  470DEF PROCcols
  480LOCAL A%
  490FOR A%=1 TO 15:COLOUR A%,255-A%*16,0,0:NEXT
  500ENDPROC
  510:
  520DEF FNtilt
  530L%+=15:IF L%>=360 L%=0
  540=SIN(RAD(L%))*80

"�  Acorn User circle challenge
�  Tilt - by R W Jeffs
:
(
� 27:�
2#� cx%(15,1),cy%(15,1),cr%(15,1)
<"L%=0:            � orbits x 15
F4D%=800:          � distance of orbit from viewer
P&R%=300:          � radius of orbit
Z#T%=�tilt:       � tilt of orbit
d%F%=1024:         � 3D perspective
n'mx%=640:my%=480: � centre of screen
x.step%=3:         � angle increase per step
�:
�	�cols
�angle%=0:I%=0:L%=0
��
� J%=I%-15:� J%<0 J%+=16
�K �0,0:ȏ cx%(J%,0),cy%(J%,0),cr%(J%,0):ȏ cx%(J%,1),cy%(J%,1),cr%(J%,1)
�( �circle(0,angle%):�circle(1,angle%)
� Ȗ
� I%+=1:� I%=16 I%=0
� angle%+=step%
�$ � angle%>=360 angle%=0:T%=�tilt
�� �
��
:
� �circle(C%,angle%)
� W%,X%,Y%,Z%,col%
"� C%=0 �
,! col%=(�(�(angle%))+1)/2*14+1
6 Z%=�(�(angle%))*R%+D%
@ W%=20/Z%*F%
J! X%=�(�(angle%))*R%/Z%*F%+mx%
T! Y%=�(�(angle%))*T%/Z%*F%+my%
^�
h! col%=(�(�(angle%))+1)/2*14+1
r Z%=�(�(angle%))*R%+D%
| W%=20/Z%*F%
�! X%=�(�(angle%))*T%/Z%*F%+mx%
�! Y%=�(�(angle%))*R%/Z%*F%+my%
��
�� 0,col%
�ȏ X%,Y%,W%
�-cx%(I%,C%)=X%:cy%(I%,C%)=Y%:cr%(I%,C%)=W%
��
�:
�� �cols
�� A%
�$� A%=1 � 15:� A%,255-A%*16,0,0:�
��
�:
� �tilt
L%+=15:� L%>=360 L%=0
=�(�(L%))*80
�
00000000  0d 00 0a 22 f4 20 20 41  63 6f 72 6e 20 55 73 65  |...".  Acorn Use|
00000010  72 20 63 69 72 63 6c 65  20 63 68 61 6c 6c 65 6e  |r circle challen|
00000020  67 65 0d 00 14 1a f4 20  20 54 69 6c 74 20 2d 20  |ge.....  Tilt - |
00000030  62 79 20 52 20 57 20 4a  65 66 66 73 0d 00 1e 05  |by R W Jeffs....|
00000040  3a 0d 00 28 0a eb 20 32  37 3a 87 0d 00 32 23 de  |:..(.. 27:...2#.|
00000050  20 63 78 25 28 31 35 2c  31 29 2c 63 79 25 28 31  | cx%(15,1),cy%(1|
00000060  35 2c 31 29 2c 63 72 25  28 31 35 2c 31 29 0d 00  |5,1),cr%(15,1)..|
00000070  3c 22 4c 25 3d 30 3a 20  20 20 20 20 20 20 20 20  |<"L%=0:         |
00000080  20 20 20 f4 20 6f 72 62  69 74 73 20 78 20 31 35  |   . orbits x 15|
00000090  0d 00 46 34 44 25 3d 38  30 30 3a 20 20 20 20 20  |..F4D%=800:     |
000000a0  20 20 20 20 20 f4 20 64  69 73 74 61 6e 63 65 20  |     . distance |
000000b0  6f 66 20 6f 72 62 69 74  20 66 72 6f 6d 20 76 69  |of orbit from vi|
000000c0  65 77 65 72 0d 00 50 26  52 25 3d 33 30 30 3a 20  |ewer..P&R%=300: |
000000d0  20 20 20 20 20 20 20 20  20 f4 20 72 61 64 69 75  |         . radiu|
000000e0  73 20 6f 66 20 6f 72 62  69 74 0d 00 5a 23 54 25  |s of orbit..Z#T%|
000000f0  3d a4 74 69 6c 74 3a 20  20 20 20 20 20 20 f4 20  |=.tilt:       . |
00000100  74 69 6c 74 20 6f 66 20  6f 72 62 69 74 0d 00 64  |tilt of orbit..d|
00000110  25 46 25 3d 31 30 32 34  3a 20 20 20 20 20 20 20  |%F%=1024:       |
00000120  20 20 f4 20 33 44 20 70  65 72 73 70 65 63 74 69  |  . 3D perspecti|
00000130  76 65 0d 00 6e 27 6d 78  25 3d 36 34 30 3a 6d 79  |ve..n'mx%=640:my|
00000140  25 3d 34 38 30 3a 20 f4  20 63 65 6e 74 72 65 20  |%=480: . centre |
00000150  6f 66 20 73 63 72 65 65  6e 0d 00 78 2e 73 74 65  |of screen..x.ste|
00000160  70 25 3d 33 3a 20 20 20  20 20 20 20 20 20 f4 20  |p%=3:         . |
00000170  61 6e 67 6c 65 20 69 6e  63 72 65 61 73 65 20 70  |angle increase p|
00000180  65 72 20 73 74 65 70 0d  00 82 05 3a 0d 00 8c 09  |er step....:....|
00000190  f2 63 6f 6c 73 0d 00 96  16 61 6e 67 6c 65 25 3d  |.cols....angle%=|
000001a0  30 3a 49 25 3d 30 3a 4c  25 3d 30 0d 00 a0 05 f5  |0:I%=0:L%=0.....|
000001b0  0d 00 aa 1b 20 4a 25 3d  49 25 2d 31 35 3a e7 20  |.... J%=I%-15:. |
000001c0  4a 25 3c 30 20 4a 25 2b  3d 31 36 0d 00 b4 4b 20  |J%<0 J%+=16...K |
000001d0  e6 30 2c 30 3a c8 8f 20  63 78 25 28 4a 25 2c 30  |.0,0:.. cx%(J%,0|
000001e0  29 2c 63 79 25 28 4a 25  2c 30 29 2c 63 72 25 28  |),cy%(J%,0),cr%(|
000001f0  4a 25 2c 30 29 3a c8 8f  20 63 78 25 28 4a 25 2c  |J%,0):.. cx%(J%,|
00000200  31 29 2c 63 79 25 28 4a  25 2c 31 29 2c 63 72 25  |1),cy%(J%,1),cr%|
00000210  28 4a 25 2c 31 29 0d 00  be 28 20 f2 63 69 72 63  |(J%,1)...( .circ|
00000220  6c 65 28 30 2c 61 6e 67  6c 65 25 29 3a f2 63 69  |le(0,angle%):.ci|
00000230  72 63 6c 65 28 31 2c 61  6e 67 6c 65 25 29 0d 00  |rcle(1,angle%)..|
00000240  c8 07 20 c8 96 0d 00 d2  17 20 49 25 2b 3d 31 3a  |.. ...... I%+=1:|
00000250  e7 20 49 25 3d 31 36 20  49 25 3d 30 0d 00 dc 12  |. I%=16 I%=0....|
00000260  20 61 6e 67 6c 65 25 2b  3d 73 74 65 70 25 0d 00  | angle%+=step%..|
00000270  e6 24 20 e7 20 61 6e 67  6c 65 25 3e 3d 33 36 30  |.$ . angle%>=360|
00000280  20 61 6e 67 6c 65 25 3d  30 3a 54 25 3d a4 74 69  | angle%=0:T%=.ti|
00000290  6c 74 0d 00 f0 07 fd 20  a3 0d 00 fa 05 e0 0d 01  |lt..... ........|
000002a0  04 05 3a 0d 01 0e 18 dd  20 f2 63 69 72 63 6c 65  |..:..... .circle|
000002b0  28 43 25 2c 61 6e 67 6c  65 25 29 0d 01 18 16 ea  |(C%,angle%).....|
000002c0  20 57 25 2c 58 25 2c 59  25 2c 5a 25 2c 63 6f 6c  | W%,X%,Y%,Z%,col|
000002d0  25 0d 01 22 0c e7 20 43  25 3d 30 20 8c 0d 01 2c  |%..".. C%=0 ...,|
000002e0  21 20 63 6f 6c 25 3d 28  9b 28 b2 28 61 6e 67 6c  |! col%=(.(.(angl|
000002f0  65 25 29 29 2b 31 29 2f  32 2a 31 34 2b 31 0d 01  |e%))+1)/2*14+1..|
00000300  36 1a 20 5a 25 3d 9b 28  b2 28 61 6e 67 6c 65 25  |6. Z%=.(.(angle%|
00000310  29 29 2a 52 25 2b 44 25  0d 01 40 10 20 57 25 3d  |))*R%+D%..@. W%=|
00000320  32 30 2f 5a 25 2a 46 25  0d 01 4a 21 20 58 25 3d  |20/Z%*F%..J! X%=|
00000330  b5 28 b2 28 61 6e 67 6c  65 25 29 29 2a 52 25 2f  |.(.(angle%))*R%/|
00000340  5a 25 2a 46 25 2b 6d 78  25 0d 01 54 21 20 59 25  |Z%*F%+mx%..T! Y%|
00000350  3d 9b 28 b2 28 61 6e 67  6c 65 25 29 29 2a 54 25  |=.(.(angle%))*T%|
00000360  2f 5a 25 2a 46 25 2b 6d  79 25 0d 01 5e 05 cc 0d  |/Z%*F%+my%..^...|
00000370  01 68 21 20 63 6f 6c 25  3d 28 b5 28 b2 28 61 6e  |.h! col%=(.(.(an|
00000380  67 6c 65 25 29 29 2b 31  29 2f 32 2a 31 34 2b 31  |gle%))+1)/2*14+1|
00000390  0d 01 72 1a 20 5a 25 3d  b5 28 b2 28 61 6e 67 6c  |..r. Z%=.(.(angl|
000003a0  65 25 29 29 2a 52 25 2b  44 25 0d 01 7c 10 20 57  |e%))*R%+D%..|. W|
000003b0  25 3d 32 30 2f 5a 25 2a  46 25 0d 01 86 21 20 58  |%=20/Z%*F%...! X|
000003c0  25 3d b5 28 b2 28 61 6e  67 6c 65 25 29 29 2a 54  |%=.(.(angle%))*T|
000003d0  25 2f 5a 25 2a 46 25 2b  6d 78 25 0d 01 90 21 20  |%/Z%*F%+mx%...! |
000003e0  59 25 3d 9b 28 b2 28 61  6e 67 6c 65 25 29 29 2a  |Y%=.(.(angle%))*|
000003f0  52 25 2f 5a 25 2a 46 25  2b 6d 79 25 0d 01 9a 05  |R%/Z%*F%+my%....|
00000400  cd 0d 01 a4 0c e6 20 30  2c 63 6f 6c 25 0d 01 ae  |...... 0,col%...|
00000410  0f c8 8f 20 58 25 2c 59  25 2c 57 25 0d 01 b8 2d  |... X%,Y%,W%...-|
00000420  63 78 25 28 49 25 2c 43  25 29 3d 58 25 3a 63 79  |cx%(I%,C%)=X%:cy|
00000430  25 28 49 25 2c 43 25 29  3d 59 25 3a 63 72 25 28  |%(I%,C%)=Y%:cr%(|
00000440  49 25 2c 43 25 29 3d 57  25 0d 01 c2 05 e1 0d 01  |I%,C%)=W%.......|
00000450  cc 05 3a 0d 01 d6 0b dd  20 f2 63 6f 6c 73 0d 01  |..:..... .cols..|
00000460  e0 08 ea 20 41 25 0d 01  ea 24 e3 20 41 25 3d 31  |... A%...$. A%=1|
00000470  20 b8 20 31 35 3a fb 20  41 25 2c 32 35 35 2d 41  | . 15:. A%,255-A|
00000480  25 2a 31 36 2c 30 2c 30  3a ed 0d 01 f4 05 e1 0d  |%*16,0,0:.......|
00000490  01 fe 05 3a 0d 02 08 0b  dd 20 a4 74 69 6c 74 0d  |...:..... .tilt.|
000004a0  02 12 19 4c 25 2b 3d 31  35 3a e7 20 4c 25 3e 3d  |...L%+=15:. L%>=|
000004b0  33 36 30 20 4c 25 3d 30  0d 02 1c 10 3d b5 28 b2  |360 L%=0....=.(.|
000004c0  28 4c 25 29 29 2a 38 30  0d ff                    |(L%))*80..|
000004ca