Home » Archimedes archive » Archimedes World » AW-1995-01-Disc1.adf » Disk1Jan95 » !AWJan95/Goodies/DrawBasic/January95/Example_4

!AWJan95/Goodies/DrawBasic/January95/Example_4

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 » Archimedes World » AW-1995-01-Disc1.adf » Disk1Jan95
Filename: !AWJan95/Goodies/DrawBasic/January95/Example_4
Read OK:
File size: 0168 bytes
Load address: 0000
Exec address: 0000
File contents
REM > Magic Rose with n points
  
INPUT "# of points on circle";n

�StorePointsOnCircle(5,5,5,n)

 �PathBegin(Magic_Rose)  
   FOR i=1 TO n  
   FOR j=i TO n : �Move(x(i),y(i)) : �Draw(x(j),y(j)) : NEXT
   NEXT   
  �PathEnd
  
  �Quit

DEF �StorePointsOnCircle(a,b,r,n)
DIM x(n),y(n)
FOR i=0 TO n
 x(i)=a+r*COS(2*PI*i/n)
 y(i)=b+r*SIN(2*PI*i/n)
 NEXT
ENDPROC
00000000  52 45 4d 20 3e 20 4d 61  67 69 63 20 52 6f 73 65  |REM > Magic Rose|
00000010  20 77 69 74 68 20 6e 20  70 6f 69 6e 74 73 0a 20  | with n points. |
00000020  20 0a 49 4e 50 55 54 20  22 23 20 6f 66 20 70 6f  | .INPUT "# of po|
00000030  69 6e 74 73 20 6f 6e 20  63 69 72 63 6c 65 22 3b  |ints on circle";|
00000040  6e 0a 0a a0 53 74 6f 72  65 50 6f 69 6e 74 73 4f  |n...StorePointsO|
00000050  6e 43 69 72 63 6c 65 28  35 2c 35 2c 35 2c 6e 29  |nCircle(5,5,5,n)|
00000060  0a 0a 20 a0 50 61 74 68  42 65 67 69 6e 28 4d 61  |.. .PathBegin(Ma|
00000070  67 69 63 5f 52 6f 73 65  29 20 20 0a 20 20 20 46  |gic_Rose)  .   F|
00000080  4f 52 20 69 3d 31 20 54  4f 20 6e 20 20 0a 20 20  |OR i=1 TO n  .  |
00000090  20 46 4f 52 20 6a 3d 69  20 54 4f 20 6e 20 3a 20  | FOR j=i TO n : |
000000a0  a0 4d 6f 76 65 28 78 28  69 29 2c 79 28 69 29 29  |.Move(x(i),y(i))|
000000b0  20 3a 20 a0 44 72 61 77  28 78 28 6a 29 2c 79 28  | : .Draw(x(j),y(|
000000c0  6a 29 29 20 3a 20 4e 45  58 54 0a 20 20 20 4e 45  |j)) : NEXT.   NE|
000000d0  58 54 20 20 20 0a 20 20  a0 50 61 74 68 45 6e 64  |XT   .  .PathEnd|
000000e0  0a 20 20 0a 20 20 a0 51  75 69 74 0a 0a 44 45 46  |.  .  .Quit..DEF|
000000f0  20 a0 53 74 6f 72 65 50  6f 69 6e 74 73 4f 6e 43  | .StorePointsOnC|
00000100  69 72 63 6c 65 28 61 2c  62 2c 72 2c 6e 29 0a 44  |ircle(a,b,r,n).D|
00000110  49 4d 20 78 28 6e 29 2c  79 28 6e 29 0a 46 4f 52  |IM x(n),y(n).FOR|
00000120  20 69 3d 30 20 54 4f 20  6e 0a 20 78 28 69 29 3d  | i=0 TO n. x(i)=|
00000130  61 2b 72 2a 43 4f 53 28  32 2a 50 49 2a 69 2f 6e  |a+r*COS(2*PI*i/n|
00000140  29 0a 20 79 28 69 29 3d  62 2b 72 2a 53 49 4e 28  |). y(i)=b+r*SIN(|
00000150  32 2a 50 49 2a 69 2f 6e  29 0a 20 4e 45 58 54 0a  |2*PI*i/n). NEXT.|
00000160  45 4e 44 50 52 4f 43 0a                           |ENDPROC.|
00000168