Home » Archimedes archive » Archimedes World » AW-1995-02-Disc1.adf » Disk1Feb95 » !AWFeb95/Goodies/DrawBasic/!DrawBasic/Library/Examples/Chapter/Exer_3/Ex_3/2

!AWFeb95/Goodies/DrawBasic/!DrawBasic/Library/Examples/Chapter/Exer_3/Ex_3/2

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-02-Disc1.adf » Disk1Feb95
Filename: !AWFeb95/Goodies/DrawBasic/!DrawBasic/Library/Examples/Chapter/Exer_3/Ex_3/2
Read OK:
File size: 019F bytes
Load address: 0000
Exec address: 0000
Duplicates

There are 3 duplicate copies of this file in the archive:

File contents
REM > Magic Rose based on circle centre (a,b) with n points
      a=5 : b=5 : radius=5
     
     
INPUT "# of points";n
angle=2*PI/n
      
DIM x(n),y(n)
FOR i=0 TO n
 x(i)=a+radius*COS(i*angle) : y(i)=b+radius*SIN(i*angle)
 NEXT
 

 path=�LineJoin(x(),y())
   
�Quit

END

DEF �LineJoin(x(),y())
LOCAL n,k,i : n=DIM(x(),1) 

 FOR i=0 TO n :
  FOR j=0 TO n
    �Line(x(i),y(i),x(j),y(j))
    NEXT
  NEXT

=path


00000000  0a 52 45 4d 20 3e 20 4d  61 67 69 63 20 52 6f 73  |.REM > Magic Ros|
00000010  65 20 62 61 73 65 64 20  6f 6e 20 63 69 72 63 6c  |e based on circl|
00000020  65 20 63 65 6e 74 72 65  20 28 61 2c 62 29 20 77  |e centre (a,b) w|
00000030  69 74 68 20 6e 20 70 6f  69 6e 74 73 0a 20 20 20  |ith n points.   |
00000040  20 20 20 61 3d 35 20 3a  20 62 3d 35 20 3a 20 72  |   a=5 : b=5 : r|
00000050  61 64 69 75 73 3d 35 0a  20 20 20 20 20 0a 20 20  |adius=5.     .  |
00000060  20 20 20 0a 49 4e 50 55  54 20 22 23 20 6f 66 20  |   .INPUT "# of |
00000070  70 6f 69 6e 74 73 22 3b  6e 0a 61 6e 67 6c 65 3d  |points";n.angle=|
00000080  32 2a 50 49 2f 6e 0a 20  20 20 20 20 20 0a 44 49  |2*PI/n.      .DI|
00000090  4d 20 78 28 6e 29 2c 79  28 6e 29 0a 46 4f 52 20  |M x(n),y(n).FOR |
000000a0  69 3d 30 20 54 4f 20 6e  0a 20 78 28 69 29 3d 61  |i=0 TO n. x(i)=a|
000000b0  2b 72 61 64 69 75 73 2a  43 4f 53 28 69 2a 61 6e  |+radius*COS(i*an|
000000c0  67 6c 65 29 20 3a 20 79  28 69 29 3d 62 2b 72 61  |gle) : y(i)=b+ra|
000000d0  64 69 75 73 2a 53 49 4e  28 69 2a 61 6e 67 6c 65  |dius*SIN(i*angle|
000000e0  29 0a 20 4e 45 58 54 0a  20 0a 0a 20 70 61 74 68  |). NEXT. .. path|
000000f0  3d bb 4c 69 6e 65 4a 6f  69 6e 28 78 28 29 2c 79  |=.LineJoin(x(),y|
00000100  28 29 29 0a 20 20 20 0a  a0 51 75 69 74 0a 0a 45  |()).   ..Quit..E|
00000110  4e 44 0a 0a 44 45 46 20  bb 4c 69 6e 65 4a 6f 69  |ND..DEF .LineJoi|
00000120  6e 28 78 28 29 2c 79 28  29 29 0a 4c 4f 43 41 4c  |n(x(),y()).LOCAL|
00000130  20 6e 2c 6b 2c 69 20 3a  20 6e 3d 44 49 4d 28 78  | n,k,i : n=DIM(x|
00000140  28 29 2c 31 29 20 0a 0a  20 46 4f 52 20 69 3d 30  |(),1) .. FOR i=0|
00000150  20 54 4f 20 6e 20 3a 0a  20 20 46 4f 52 20 6a 3d  | TO n :.  FOR j=|
00000160  30 20 54 4f 20 6e 0a 20  20 20 20 a0 4c 69 6e 65  |0 TO n.    .Line|
00000170  28 78 28 69 29 2c 79 28  69 29 2c 78 28 6a 29 2c  |(x(i),y(i),x(j),|
00000180  79 28 6a 29 29 0a 20 20  20 20 4e 45 58 54 0a 20  |y(j)).    NEXT. |
00000190  20 4e 45 58 54 0a 0a 3d  70 61 74 68 0a 0a 0a     | NEXT..=path...|
0000019f