Home » Archimedes archive » Acorn User » AU 1997-10 A.adf » Extras » Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/h/draw/figure

Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/h/draw/figure

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-10 A.adf » Extras
Filename: Apple][e/PD/BOB/ARMBOB/!ArmBob/progs/h/draw/figure
Read OK:
File size: 03D2 bytes
Load address: 0000
Exec address: 0000
File contents
/*******************************************************
 *                                                     *
 *  draw.figure Library        GCW  27/12/94           *
 *                                                     *
 *******************************************************/

/* Uses draw.object, draw.file */

drawfile::circle(x,y,r)
{
 local a;
 a = floor(4*r*(sqrt(2.0)-1.0)/3);
 this->move(x,y+r);
 this->bezier(x+a,y+r,x+r,y+a,x+r,y);
 this->bezier(x+r,y-a,x+a,y-r,x,y-r);
 this->bezier(x-a,y-r,x-r,y-a,x-r,y);
 this->bezier(x-r,y+a,x-a,y+r,x,y+r);
 this->close_with_line();
}

drawfile::ellipse(x,y,a,b)
{
 local a1,b1;
 a1 = floor(4*a*(sqrt(2.0)-1.0)/3);
 b1 = floor(4*b*(sqrt(2.0)-1.0)/3);
 this->move(x,y+b);
 this->bezier(x+a1,y+b,x+a,y+b1,x+a,y);
 this->bezier(x+a,y-b1,x+a1,y-b,x,y-b);
 this->bezier(x-a1,y-b,x-a,y-b1,x-a,y);
 this->bezier(x-a,y+b1,x-a1,y+b,x,y+b);
 this->close_with_line();
}


/* ------------ end of figure definitions ------------- */
00000000  2f 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |/***************|
00000010  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000030  2a 2a 2a 2a 2a 2a 2a 2a  0a 20 2a 20 20 20 20 20  |********. *     |
00000040  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000070  2a 0a 20 2a 20 20 64 72  61 77 2e 66 69 67 75 72  |*. *  draw.figur|
00000080  65 20 4c 69 62 72 61 72  79 20 20 20 20 20 20 20  |e Library       |
00000090  20 47 43 57 20 20 32 37  2f 31 32 2f 39 34 20 20  | GCW  27/12/94  |
000000a0  20 20 20 20 20 20 20 20  20 2a 0a 20 2a 20 20 20  |         *. *   |
000000b0  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
000000e0  20 20 2a 0a 20 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |  *. ***********|
000000f0  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2a 2a 2a 2a  |****************|
*
00000110  2a 2a 2a 2a 2a 2a 2a 2a  2a 2a 2a 2a 2f 0a 0a 2f  |************/../|
00000120  2a 20 55 73 65 73 20 64  72 61 77 2e 6f 62 6a 65  |* Uses draw.obje|
00000130  63 74 2c 20 64 72 61 77  2e 66 69 6c 65 20 2a 2f  |ct, draw.file */|
00000140  0a 0a 64 72 61 77 66 69  6c 65 3a 3a 63 69 72 63  |..drawfile::circ|
00000150  6c 65 28 78 2c 79 2c 72  29 0a 7b 0a 20 6c 6f 63  |le(x,y,r).{. loc|
00000160  61 6c 20 61 3b 0a 20 61  20 3d 20 66 6c 6f 6f 72  |al a;. a = floor|
00000170  28 34 2a 72 2a 28 73 71  72 74 28 32 2e 30 29 2d  |(4*r*(sqrt(2.0)-|
00000180  31 2e 30 29 2f 33 29 3b  0a 20 74 68 69 73 2d 3e  |1.0)/3);. this->|
00000190  6d 6f 76 65 28 78 2c 79  2b 72 29 3b 0a 20 74 68  |move(x,y+r);. th|
000001a0  69 73 2d 3e 62 65 7a 69  65 72 28 78 2b 61 2c 79  |is->bezier(x+a,y|
000001b0  2b 72 2c 78 2b 72 2c 79  2b 61 2c 78 2b 72 2c 79  |+r,x+r,y+a,x+r,y|
000001c0  29 3b 0a 20 74 68 69 73  2d 3e 62 65 7a 69 65 72  |);. this->bezier|
000001d0  28 78 2b 72 2c 79 2d 61  2c 78 2b 61 2c 79 2d 72  |(x+r,y-a,x+a,y-r|
000001e0  2c 78 2c 79 2d 72 29 3b  0a 20 74 68 69 73 2d 3e  |,x,y-r);. this->|
000001f0  62 65 7a 69 65 72 28 78  2d 61 2c 79 2d 72 2c 78  |bezier(x-a,y-r,x|
00000200  2d 72 2c 79 2d 61 2c 78  2d 72 2c 79 29 3b 0a 20  |-r,y-a,x-r,y);. |
00000210  74 68 69 73 2d 3e 62 65  7a 69 65 72 28 78 2d 72  |this->bezier(x-r|
00000220  2c 79 2b 61 2c 78 2d 61  2c 79 2b 72 2c 78 2c 79  |,y+a,x-a,y+r,x,y|
00000230  2b 72 29 3b 0a 20 74 68  69 73 2d 3e 63 6c 6f 73  |+r);. this->clos|
00000240  65 5f 77 69 74 68 5f 6c  69 6e 65 28 29 3b 0a 7d  |e_with_line();.}|
00000250  0a 0a 64 72 61 77 66 69  6c 65 3a 3a 65 6c 6c 69  |..drawfile::elli|
00000260  70 73 65 28 78 2c 79 2c  61 2c 62 29 0a 7b 0a 20  |pse(x,y,a,b).{. |
00000270  6c 6f 63 61 6c 20 61 31  2c 62 31 3b 0a 20 61 31  |local a1,b1;. a1|
00000280  20 3d 20 66 6c 6f 6f 72  28 34 2a 61 2a 28 73 71  | = floor(4*a*(sq|
00000290  72 74 28 32 2e 30 29 2d  31 2e 30 29 2f 33 29 3b  |rt(2.0)-1.0)/3);|
000002a0  0a 20 62 31 20 3d 20 66  6c 6f 6f 72 28 34 2a 62  |. b1 = floor(4*b|
000002b0  2a 28 73 71 72 74 28 32  2e 30 29 2d 31 2e 30 29  |*(sqrt(2.0)-1.0)|
000002c0  2f 33 29 3b 0a 20 74 68  69 73 2d 3e 6d 6f 76 65  |/3);. this->move|
000002d0  28 78 2c 79 2b 62 29 3b  0a 20 74 68 69 73 2d 3e  |(x,y+b);. this->|
000002e0  62 65 7a 69 65 72 28 78  2b 61 31 2c 79 2b 62 2c  |bezier(x+a1,y+b,|
000002f0  78 2b 61 2c 79 2b 62 31  2c 78 2b 61 2c 79 29 3b  |x+a,y+b1,x+a,y);|
00000300  0a 20 74 68 69 73 2d 3e  62 65 7a 69 65 72 28 78  |. this->bezier(x|
00000310  2b 61 2c 79 2d 62 31 2c  78 2b 61 31 2c 79 2d 62  |+a,y-b1,x+a1,y-b|
00000320  2c 78 2c 79 2d 62 29 3b  0a 20 74 68 69 73 2d 3e  |,x,y-b);. this->|
00000330  62 65 7a 69 65 72 28 78  2d 61 31 2c 79 2d 62 2c  |bezier(x-a1,y-b,|
00000340  78 2d 61 2c 79 2d 62 31  2c 78 2d 61 2c 79 29 3b  |x-a,y-b1,x-a,y);|
00000350  0a 20 74 68 69 73 2d 3e  62 65 7a 69 65 72 28 78  |. this->bezier(x|
00000360  2d 61 2c 79 2b 62 31 2c  78 2d 61 31 2c 79 2b 62  |-a,y+b1,x-a1,y+b|
00000370  2c 78 2c 79 2b 62 29 3b  0a 20 74 68 69 73 2d 3e  |,x,y+b);. this->|
00000380  63 6c 6f 73 65 5f 77 69  74 68 5f 6c 69 6e 65 28  |close_with_line(|
00000390  29 3b 0a 7d 0a 0a 0a 2f  2a 20 2d 2d 2d 2d 2d 2d  |);.}.../* ------|
000003a0  2d 2d 2d 2d 2d 2d 20 65  6e 64 20 6f 66 20 66 69  |------ end of fi|
000003b0  67 75 72 65 20 64 65 66  69 6e 69 74 69 6f 6e 73  |gure definitions|
000003c0  20 2d 2d 2d 2d 2d 2d 2d  2d 2d 2d 2d 2d 2d 20 2a  | ------------- *|
000003d0  2f 0a                                             |/.|
000003d2