Home » Archimedes archive » Archimedes World » AW-1994-04-Disc1.adf » Disk1Apr94 » !AWApr94/Goodies/Basic/Objects/Transforms/RotMagTran

!AWApr94/Goodies/Basic/Objects/Transforms/RotMagTran

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-1994-04-Disc1.adf » Disk1Apr94
Filename: !AWApr94/Goodies/Basic/Objects/Transforms/RotMagTran
Read OK:
File size: 0414 bytes
Load address: 0000
Exec address: 0000
File contents
    1
    2LIBRARY "PathLib:OS_units.Transforms"
    3LIBRARY "PathLib:OS_units.Draw"
    4
    5
    6REM Create Transform
    7    PROCCreateTransforms
    8 
    9    
   10REM Creates a draw file consting of only a 40 byte header
   11    file%=FNDraw_CreateFile("NullFile",10000)
   12
   13REM Create a square
   14    PROCDraw_PathBegin(-1,221<<8,2<<8,2)
   15    PROCCreate_Squares    
   16    PROCDraw_PathEnd
   17
   18
   19REM Save this file to the Pipe filing system
   20    PROCDraw_SaveToPipeFS("RotMagTran",file%)
   21
   22END
   23
   24DEF PROCCreateTransforms
   25
   26 REM Rotation, magnification & translation
   27
   28 PROCPath_CreateTransform(rotmagtrans%)
   29 PROCPath_Rotation(rotmagtrans%,PI/16)
   30 PROCPath_Magnify(rotmagtrans%,.95)
   31 PROCPath_Translation(rotmagtrans%,20,20)
   32  
   33 REM Translation
   34     PROCPath_CreateTransform(translate%)
   35     PROCPath_Translation(translate%,200,200)
   36ENDPROC
   37
   38DEF PROCCreate_Squares
   39 square%=file_pointer% : PROCDraw_Square(0,0,100) : old%=square%
   40 FOR i%=1 TO 25
   41  new%=FNDraw_AddPath(old%,rotmagtrans%) : old%=new%
   42  NEXT
   43  PROCDraw_AlterPath(square%,translate%)
   44ENDPROC
   45
   46

$ț "PathLib:OS_units.Transforms"
ț "PathLib:OS_units.Draw"


� Create Transform
    �CreateTransforms
 
	    

;� Creates a draw file consting of only a 40 byte header
0    file%=�Draw_CreateFile("NullFile",10000)


� Create a square
)    �Draw_PathBegin(-1,221<<8,2<<8,2)
    �Create_Squares    
    �Draw_PathEnd


.� Save this file to the Pipe filing system
.    �Draw_SaveToPipeFS("RotMagTran",file%)

�

� �CreateTransforms

, � Rotation, magnification & translation

( �Path_CreateTransform(rotmagtrans%)
& �Path_Rotation(rotmagtrans%,�/16)
$ �Path_Magnify(rotmagtrans%,.95)
* �Path_Translation(rotmagtrans%,20,20)
   
! � Translation
"*     �Path_CreateTransform(translate%)
#.     �Path_Translation(translate%,200,200)
$�
%
&� �Create_Squares
'A square%=file_pointer% : �Draw_Square(0,0,100) : old%=square%
( � i%=1 � 25
)7  new%=�Draw_AddPath(old%,rotmagtrans%) : old%=new%
*  �
+)  �Draw_AlterPath(square%,translate%)
,�
-
.
�
00000000  0d 00 01 04 0d 00 02 24  c8 9b 20 22 50 61 74 68  |.......$.. "Path|
00000010  4c 69 62 3a 4f 53 5f 75  6e 69 74 73 2e 54 72 61  |Lib:OS_units.Tra|
00000020  6e 73 66 6f 72 6d 73 22  0d 00 03 1e c8 9b 20 22  |nsforms"...... "|
00000030  50 61 74 68 4c 69 62 3a  4f 53 5f 75 6e 69 74 73  |PathLib:OS_units|
00000040  2e 44 72 61 77 22 0d 00  04 04 0d 00 05 04 0d 00  |.Draw"..........|
00000050  06 16 f4 20 43 72 65 61  74 65 20 54 72 61 6e 73  |... Create Trans|
00000060  66 6f 72 6d 0d 00 07 19  20 20 20 20 f2 43 72 65  |form....    .Cre|
00000070  61 74 65 54 72 61 6e 73  66 6f 72 6d 73 0d 00 08  |ateTransforms...|
00000080  05 20 0d 00 09 08 20 20  20 20 0d 00 0a 3b f4 20  |. ....    ...;. |
00000090  43 72 65 61 74 65 73 20  61 20 64 72 61 77 20 66  |Creates a draw f|
000000a0  69 6c 65 20 63 6f 6e 73  74 69 6e 67 20 6f 66 20  |ile consting of |
000000b0  6f 6e 6c 79 20 61 20 34  30 20 62 79 74 65 20 68  |only a 40 byte h|
000000c0  65 61 64 65 72 0d 00 0b  30 20 20 20 20 66 69 6c  |eader...0    fil|
000000d0  65 25 3d a4 44 72 61 77  5f 43 72 65 61 74 65 46  |e%=.Draw_CreateF|
000000e0  69 6c 65 28 22 4e 75 6c  6c 46 69 6c 65 22 2c 31  |ile("NullFile",1|
000000f0  30 30 30 30 29 0d 00 0c  04 0d 00 0d 15 f4 20 43  |0000)......... C|
00000100  72 65 61 74 65 20 61 20  73 71 75 61 72 65 0d 00  |reate a square..|
00000110  0e 29 20 20 20 20 f2 44  72 61 77 5f 50 61 74 68  |.)    .Draw_Path|
00000120  42 65 67 69 6e 28 2d 31  2c 32 32 31 3c 3c 38 2c  |Begin(-1,221<<8,|
00000130  32 3c 3c 38 2c 32 29 0d  00 0f 1b 20 20 20 20 f2  |2<<8,2)....    .|
00000140  43 72 65 61 74 65 5f 53  71 75 61 72 65 73 20 20  |Create_Squares  |
00000150  20 20 0d 00 10 15 20 20  20 20 f2 44 72 61 77 5f  |  ....    .Draw_|
00000160  50 61 74 68 45 6e 64 0d  00 11 04 0d 00 12 04 0d  |PathEnd.........|
00000170  00 13 2e f4 20 53 61 76  65 20 74 68 69 73 20 66  |.... Save this f|
00000180  69 6c 65 20 74 6f 20 74  68 65 20 50 69 70 65 20  |ile to the Pipe |
00000190  66 69 6c 69 6e 67 20 73  79 73 74 65 6d 0d 00 14  |filing system...|
000001a0  2e 20 20 20 20 f2 44 72  61 77 5f 53 61 76 65 54  |.    .Draw_SaveT|
000001b0  6f 50 69 70 65 46 53 28  22 52 6f 74 4d 61 67 54  |oPipeFS("RotMagT|
000001c0  72 61 6e 22 2c 66 69 6c  65 25 29 0d 00 15 04 0d  |ran",file%).....|
000001d0  00 16 05 e0 0d 00 17 04  0d 00 18 17 dd 20 f2 43  |............. .C|
000001e0  72 65 61 74 65 54 72 61  6e 73 66 6f 72 6d 73 0d  |reateTransforms.|
000001f0  00 19 04 0d 00 1a 2c 20  f4 20 52 6f 74 61 74 69  |......, . Rotati|
00000200  6f 6e 2c 20 6d 61 67 6e  69 66 69 63 61 74 69 6f  |on, magnificatio|
00000210  6e 20 26 20 74 72 61 6e  73 6c 61 74 69 6f 6e 0d  |n & translation.|
00000220  00 1b 04 0d 00 1c 28 20  f2 50 61 74 68 5f 43 72  |......( .Path_Cr|
00000230  65 61 74 65 54 72 61 6e  73 66 6f 72 6d 28 72 6f  |eateTransform(ro|
00000240  74 6d 61 67 74 72 61 6e  73 25 29 0d 00 1d 26 20  |tmagtrans%)...& |
00000250  f2 50 61 74 68 5f 52 6f  74 61 74 69 6f 6e 28 72  |.Path_Rotation(r|
00000260  6f 74 6d 61 67 74 72 61  6e 73 25 2c af 2f 31 36  |otmagtrans%,./16|
00000270  29 0d 00 1e 24 20 f2 50  61 74 68 5f 4d 61 67 6e  |)...$ .Path_Magn|
00000280  69 66 79 28 72 6f 74 6d  61 67 74 72 61 6e 73 25  |ify(rotmagtrans%|
00000290  2c 2e 39 35 29 0d 00 1f  2a 20 f2 50 61 74 68 5f  |,.95)...* .Path_|
000002a0  54 72 61 6e 73 6c 61 74  69 6f 6e 28 72 6f 74 6d  |Translation(rotm|
000002b0  61 67 74 72 61 6e 73 25  2c 32 30 2c 32 30 29 0d  |agtrans%,20,20).|
000002c0  00 20 06 20 20 0d 00 21  12 20 f4 20 54 72 61 6e  |. .  ..!. . Tran|
000002d0  73 6c 61 74 69 6f 6e 0d  00 22 2a 20 20 20 20 20  |slation.."*     |
000002e0  f2 50 61 74 68 5f 43 72  65 61 74 65 54 72 61 6e  |.Path_CreateTran|
000002f0  73 66 6f 72 6d 28 74 72  61 6e 73 6c 61 74 65 25  |sform(translate%|
00000300  29 0d 00 23 2e 20 20 20  20 20 f2 50 61 74 68 5f  |)..#.     .Path_|
00000310  54 72 61 6e 73 6c 61 74  69 6f 6e 28 74 72 61 6e  |Translation(tran|
00000320  73 6c 61 74 65 25 2c 32  30 30 2c 32 30 30 29 0d  |slate%,200,200).|
00000330  00 24 05 e1 0d 00 25 04  0d 00 26 15 dd 20 f2 43  |.$....%...&.. .C|
00000340  72 65 61 74 65 5f 53 71  75 61 72 65 73 0d 00 27  |reate_Squares..'|
00000350  41 20 73 71 75 61 72 65  25 3d 66 69 6c 65 5f 70  |A square%=file_p|
00000360  6f 69 6e 74 65 72 25 20  3a 20 f2 44 72 61 77 5f  |ointer% : .Draw_|
00000370  53 71 75 61 72 65 28 30  2c 30 2c 31 30 30 29 20  |Square(0,0,100) |
00000380  3a 20 6f 6c 64 25 3d 73  71 75 61 72 65 25 0d 00  |: old%=square%..|
00000390  28 10 20 e3 20 69 25 3d  31 20 b8 20 32 35 0d 00  |(. . i%=1 . 25..|
000003a0  29 37 20 20 6e 65 77 25  3d a4 44 72 61 77 5f 41  |)7  new%=.Draw_A|
000003b0  64 64 50 61 74 68 28 6f  6c 64 25 2c 72 6f 74 6d  |ddPath(old%,rotm|
000003c0  61 67 74 72 61 6e 73 25  29 20 3a 20 6f 6c 64 25  |agtrans%) : old%|
000003d0  3d 6e 65 77 25 0d 00 2a  07 20 20 ed 0d 00 2b 29  |=new%..*.  ...+)|
000003e0  20 20 f2 44 72 61 77 5f  41 6c 74 65 72 50 61 74  |  .Draw_AlterPat|
000003f0  68 28 73 71 75 61 72 65  25 2c 74 72 61 6e 73 6c  |h(square%,transl|
00000400  61 74 65 25 29 0d 00 2c  05 e1 0d 00 2d 04 0d 00  |ate%)..,....-...|
00000410  2e 04 0d ff                                       |....|
00000414