Home » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199403.adf » Disk1Mar94 » !AWMar94/Goodies/Basic/!PathLib/Library/OS_units/Transforms
!AWMar94/Goodies/Basic/!PathLib/Library/OS_units/Transforms
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 » Recent acquisitions » Acorn ADFS disks » adfs_ArchimedesWorld_199403.adf » Disk1Mar94 |
Filename: | !AWMar94/Goodies/Basic/!PathLib/Library/OS_units/Transforms |
Read OK: | ✔ |
File size: | 0730 bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
1REM > PathLib:OS_units.Transforms 2 3DEF PROCPath_Transform(RETURN path%,transform%) 4 REM -------------------------------------- 5 REM Recalculates path% by using transform% 6 REM -------------------------------------- 7 SYS "Draw_TransformPath",path%,0,transform%,0 8 ENDPROC 9 10DEF PROCPath_CreateTransform(RETURN transform%) 11 REM ------------------------------------------- 12 REM Creates byte array for transform: 13 REM 14 REM X=ax+by+e , Y=cx+dy+f 15 REM 16 REM where 17 REM a=transform%!0 b=transform%!4 18 REM c=transform%!8 c=transform%!12 19 REM 20 REM e=transform%!16 f=transform%!20 21 REM -------------------------------------------- 22 LOCAL i% 23 DIM transform% 6*4 24 FOR i%=0 TO 20 STEP 4 : transform%!i%=0 : NEXT 25 transform%!0=1<<16 : transform%!12=1<<16 26 ENDPROC 27 28 29DEF PROCPath_Translation(transform%,dx%,dy%) 30 REM --------------------- 31 REM Creates a translation 32 REM I.e. calculates e,f 33 REM --------------------- 34 transform%!16=dx%*256 : transform%!20=dy%*256 35 ENDPROC 36 37DEF PROCPath_Magnify(transform%,m) 38 REM --------------------------------- 39 REM Magnifies 40 REM I.e. 41 REM - - - - 42 REM | a b | = m * | a b | 43 REM | c d | | c d | 44 REM - - - - 45 REM --------------------------------- 46 transform%!0=m*(transform%!0) : transform%!4=m*(transform%!4) 47 transform%!8=m*(transform%!8) : transform%!12=m*(transform%!12) 48 ENDPROC 49 50DEF PROCPath_Rotation(transform%,theta) 51 REM --------------------------------- 52 REM Creates a rotation 53 REM I.e. 54 REM a=COStheta b=SINtheta 55 REM c=-SINtheta d=COStheta 56 REM --------------------------------- 57 c%=INT(COStheta*2^16+.5) : s%=INT(SINtheta*2^16+.5) 58 transform%!0=c% : transform%!4=s% 59 transform%!8=-s% : transform%!12=c% 60 ENDPROC 61
#� > PathLib:OS_units.Transforms )� �Path_Transform(� path%,transform%) - � -------------------------------------- - � Recalculates path% by using transform% - � -------------------------------------- 1 ș "Draw_TransformPath",path%,0,transform%,0 � )� �Path_CreateTransform(� transform%) 2 � ------------------------------------------- ( � Creates byte array for transform: � , � X=ax+by+e , Y=cx+dy+f � � where 2 � a=transform%!0 b=transform%!4 3 � c=transform%!8 c=transform%!12 � 3 � e=transform%!16 f=transform%!20 3 � -------------------------------------------- � i% � transform% 6*4 * � i%=0 � 20 � 4 : transform%!i%=0 : � - transform%!0=1<<16 : transform%!12=1<<16 � +� �Path_Translation(transform%,dx%,dy%) � --------------------- � Creates a translation � I.e. calculates e,f ! � --------------------- "2 transform%!16=dx%*256 : transform%!20=dy%*256 # � $ %!� �Path_Magnify(transform%,m) &( � --------------------------------- ' � Magnifies ( � I.e. )' � - - - - *' � | a b | = m * | a b | +' � | c d | | c d | ,' � - - - - -( � --------------------------------- .B transform%!0=m*(transform%!0) : transform%!4=m*(transform%!4) /D transform%!8=m*(transform%!8) : transform%!12=m*(transform%!12) 0 � 1 2&� �Path_Rotation(transform%,theta) 3( � --------------------------------- 4 � Creates a rotation 5 � I.e. 6( � a=COStheta b=SINtheta 7( � c=-SINtheta d=COStheta 8( � --------------------------------- 90 c%=�(�theta*2^16+.5) : s%=�(�theta*2^16+.5) :( transform%!0=c% : transform%!4=s% ;( transform%!8=-s% : transform%!12=c% < � = �
00000000 0d 00 01 23 f4 20 3e 20 50 61 74 68 4c 69 62 3a |...#. > PathLib:| 00000010 4f 53 5f 75 6e 69 74 73 2e 54 72 61 6e 73 66 6f |OS_units.Transfo| 00000020 72 6d 73 0d 00 02 04 0d 00 03 29 dd 20 f2 50 61 |rms.......). .Pa| 00000030 74 68 5f 54 72 61 6e 73 66 6f 72 6d 28 f8 20 70 |th_Transform(. p| 00000040 61 74 68 25 2c 74 72 61 6e 73 66 6f 72 6d 25 29 |ath%,transform%)| 00000050 0d 00 04 2d 20 f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d |...- . ---------| 00000060 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000070 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 05 |-------------...| 00000080 2d 20 f4 20 52 65 63 61 6c 63 75 6c 61 74 65 73 |- . Recalculates| 00000090 20 70 61 74 68 25 20 62 79 20 75 73 69 6e 67 20 | path% by using | 000000a0 74 72 61 6e 73 66 6f 72 6d 25 0d 00 06 2d 20 f4 |transform%...- .| 000000b0 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ---------------| 000000c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 000000d0 2d 2d 2d 2d 2d 2d 2d 0d 00 07 31 20 c8 99 20 22 |-------...1 .. "| 000000e0 44 72 61 77 5f 54 72 61 6e 73 66 6f 72 6d 50 61 |Draw_TransformPa| 000000f0 74 68 22 2c 70 61 74 68 25 2c 30 2c 74 72 61 6e |th",path%,0,tran| 00000100 73 66 6f 72 6d 25 2c 30 0d 00 08 06 20 e1 0d 00 |sform%,0.... ...| 00000110 09 04 0d 00 0a 29 dd 20 f2 50 61 74 68 5f 43 72 |.....). .Path_Cr| 00000120 65 61 74 65 54 72 61 6e 73 66 6f 72 6d 28 f8 20 |eateTransform(. | 00000130 74 72 61 6e 73 66 6f 72 6d 25 29 0d 00 0b 32 20 |transform%)...2 | 00000140 f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |. --------------| 00000150 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000160 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 0c |-------------...| 00000170 28 20 f4 20 43 72 65 61 74 65 73 20 62 79 74 65 |( . Creates byte| 00000180 20 61 72 72 61 79 20 66 6f 72 20 74 72 61 6e 73 | array for trans| 00000190 66 6f 72 6d 3a 0d 00 0d 06 20 f4 0d 00 0e 2c 20 |form:.... ...., | 000001a0 f4 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. | 000001b0 58 3d 61 78 2b 62 79 2b 65 20 20 2c 20 20 59 3d |X=ax+by+e , Y=| 000001c0 63 78 2b 64 79 2b 66 0d 00 0f 06 20 f4 0d 00 10 |cx+dy+f.... ....| 000001d0 0c 20 f4 20 77 68 65 72 65 0d 00 11 32 20 f4 20 |. . where...2 . | 000001e0 20 20 20 20 20 20 20 20 20 20 20 20 61 3d 74 72 | a=tr| 000001f0 61 6e 73 66 6f 72 6d 25 21 30 20 20 20 62 3d 74 |ansform%!0 b=t| 00000200 72 61 6e 73 66 6f 72 6d 25 21 34 0d 00 12 33 20 |ransform%!4...3 | 00000210 f4 20 20 20 20 20 20 20 20 20 20 20 20 20 63 3d |. c=| 00000220 74 72 61 6e 73 66 6f 72 6d 25 21 38 20 20 20 63 |transform%!8 c| 00000230 3d 74 72 61 6e 73 66 6f 72 6d 25 21 31 32 0d 00 |=transform%!12..| 00000240 13 06 20 f4 0d 00 14 33 20 f4 20 20 20 20 20 20 |.. ....3 . | 00000250 20 20 20 20 20 20 20 65 3d 74 72 61 6e 73 66 6f | e=transfo| 00000260 72 6d 25 21 31 36 20 20 66 3d 74 72 61 6e 73 66 |rm%!16 f=transf| 00000270 6f 72 6d 25 21 32 30 0d 00 15 33 20 f4 20 2d 2d |orm%!20...3 . --| 00000280 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000002a0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 16 09 20 ea |----------.... .| 000002b0 20 69 25 0d 00 17 15 20 de 20 74 72 61 6e 73 66 | i%.... . transf| 000002c0 6f 72 6d 25 20 36 2a 34 0d 00 18 2a 20 e3 20 69 |orm% 6*4...* . i| 000002d0 25 3d 30 20 b8 20 32 30 20 88 20 34 20 3a 20 74 |%=0 . 20 . 4 : t| 000002e0 72 61 6e 73 66 6f 72 6d 25 21 69 25 3d 30 20 3a |ransform%!i%=0 :| 000002f0 20 ed 0d 00 19 2d 20 74 72 61 6e 73 66 6f 72 6d | ....- transform| 00000300 25 21 30 3d 31 3c 3c 31 36 20 3a 20 74 72 61 6e |%!0=1<<16 : tran| 00000310 73 66 6f 72 6d 25 21 31 32 3d 31 3c 3c 31 36 0d |sform%!12=1<<16.| 00000320 00 1a 06 20 e1 0d 00 1b 04 0d 00 1c 04 0d 00 1d |... ............| 00000330 2b dd 20 f2 50 61 74 68 5f 54 72 61 6e 73 6c 61 |+. .Path_Transla| 00000340 74 69 6f 6e 28 74 72 61 6e 73 66 6f 72 6d 25 2c |tion(transform%,| 00000350 64 78 25 2c 64 79 25 29 0d 00 1e 1c 20 f4 20 2d |dx%,dy%).... . -| 00000360 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000370 2d 2d 2d 2d 0d 00 1f 1c 20 f4 20 43 72 65 61 74 |----.... . Creat| 00000380 65 73 20 61 20 74 72 61 6e 73 6c 61 74 69 6f 6e |es a translation| 00000390 0d 00 20 1a 20 f4 20 49 2e 65 2e 20 63 61 6c 63 |.. . . I.e. calc| 000003a0 75 6c 61 74 65 73 20 65 2c 66 0d 00 21 1c 20 f4 |ulates e,f..!. .| 000003b0 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ---------------| 000003c0 2d 2d 2d 2d 2d 2d 0d 00 22 32 20 74 72 61 6e 73 |------.."2 trans| 000003d0 66 6f 72 6d 25 21 31 36 3d 64 78 25 2a 32 35 36 |form%!16=dx%*256| 000003e0 20 3a 20 74 72 61 6e 73 66 6f 72 6d 25 21 32 30 | : transform%!20| 000003f0 3d 64 79 25 2a 32 35 36 0d 00 23 06 20 e1 0d 00 |=dy%*256..#. ...| 00000400 24 04 0d 00 25 21 dd 20 f2 50 61 74 68 5f 4d 61 |$...%!. .Path_Ma| 00000410 67 6e 69 66 79 28 74 72 61 6e 73 66 6f 72 6d 25 |gnify(transform%| 00000420 2c 6d 29 0d 00 26 28 20 f4 20 2d 2d 2d 2d 2d 2d |,m)..&( . ------| 00000430 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000440 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 27 10 20 |-----------..'. | 00000450 f4 20 4d 61 67 6e 69 66 69 65 73 0d 00 28 0b 20 |. Magnifies..(. | 00000460 f4 20 49 2e 65 2e 0d 00 29 27 20 f4 20 20 20 20 |. I.e...)' . | 00000470 20 20 20 20 20 20 20 2d 20 20 20 20 20 2d 20 20 | - - | 00000480 20 20 20 20 20 20 2d 20 20 20 20 20 2d 0d 00 2a | - -..*| 00000490 27 20 f4 20 20 20 20 20 20 20 20 20 20 20 7c 20 |' . | | 000004a0 61 20 62 20 7c 20 20 3d 20 6d 20 2a 20 7c 20 61 |a b | = m * | a| 000004b0 20 62 20 7c 0d 00 2b 27 20 f4 20 20 20 20 20 20 | b |..+' . | 000004c0 20 20 20 20 20 7c 20 63 20 64 20 7c 20 20 20 20 | | c d | | 000004d0 20 20 20 20 7c 20 63 20 64 20 7c 0d 00 2c 27 20 | | c d |..,' | 000004e0 f4 20 20 20 20 20 20 20 20 20 20 20 2d 20 20 20 |. - | 000004f0 20 20 2d 20 20 20 20 20 20 20 20 2d 20 20 20 20 | - - | 00000500 20 2d 0d 00 2d 28 20 f4 20 2d 2d 2d 2d 2d 2d 2d | -..-( . -------| 00000510 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000520 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 2e 42 20 74 |----------...B t| 00000530 72 61 6e 73 66 6f 72 6d 25 21 30 3d 6d 2a 28 74 |ransform%!0=m*(t| 00000540 72 61 6e 73 66 6f 72 6d 25 21 30 29 20 3a 20 74 |ransform%!0) : t| 00000550 72 61 6e 73 66 6f 72 6d 25 21 34 3d 6d 2a 28 74 |ransform%!4=m*(t| 00000560 72 61 6e 73 66 6f 72 6d 25 21 34 29 0d 00 2f 44 |ransform%!4)../D| 00000570 20 74 72 61 6e 73 66 6f 72 6d 25 21 38 3d 6d 2a | transform%!8=m*| 00000580 28 74 72 61 6e 73 66 6f 72 6d 25 21 38 29 20 3a |(transform%!8) :| 00000590 20 74 72 61 6e 73 66 6f 72 6d 25 21 31 32 3d 6d | transform%!12=m| 000005a0 2a 28 74 72 61 6e 73 66 6f 72 6d 25 21 31 32 29 |*(transform%!12)| 000005b0 0d 00 30 06 20 e1 0d 00 31 04 0d 00 32 26 dd 20 |..0. ...1...2&. | 000005c0 f2 50 61 74 68 5f 52 6f 74 61 74 69 6f 6e 28 74 |.Path_Rotation(t| 000005d0 72 61 6e 73 66 6f 72 6d 25 2c 74 68 65 74 61 29 |ransform%,theta)| 000005e0 0d 00 33 28 20 f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d |..3( . ---------| 000005f0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 00000600 2d 2d 2d 2d 2d 2d 2d 2d 0d 00 34 19 20 f4 20 43 |--------..4. . C| 00000610 72 65 61 74 65 73 20 61 20 72 6f 74 61 74 69 6f |reates a rotatio| 00000620 6e 0d 00 35 0b 20 f4 20 49 2e 65 2e 0d 00 36 28 |n..5. . I.e...6(| 00000630 20 f4 20 20 20 20 20 20 20 20 20 20 20 61 3d 43 | . a=C| 00000640 4f 53 74 68 65 74 61 20 20 20 62 3d 53 49 4e 74 |OStheta b=SINt| 00000650 68 65 74 61 0d 00 37 28 20 f4 20 20 20 20 20 20 |heta..7( . | 00000660 20 20 20 20 20 63 3d 2d 53 49 4e 74 68 65 74 61 | c=-SINtheta| 00000670 20 20 64 3d 43 4f 53 74 68 65 74 61 0d 00 38 28 | d=COStheta..8(| 00000680 20 f4 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | . -------------| 00000690 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| 000006a0 2d 2d 2d 2d 0d 00 39 30 20 63 25 3d a8 28 9b 74 |----..90 c%=.(.t| 000006b0 68 65 74 61 2a 32 5e 31 36 2b 2e 35 29 20 3a 20 |heta*2^16+.5) : | 000006c0 73 25 3d a8 28 b5 74 68 65 74 61 2a 32 5e 31 36 |s%=.(.theta*2^16| 000006d0 2b 2e 35 29 0d 00 3a 28 20 74 72 61 6e 73 66 6f |+.5)..:( transfo| 000006e0 72 6d 25 21 30 3d 63 25 20 20 3a 20 74 72 61 6e |rm%!0=c% : tran| 000006f0 73 66 6f 72 6d 25 21 34 3d 73 25 20 0d 00 3b 28 |sform%!4=s% ..;(| 00000700 20 74 72 61 6e 73 66 6f 72 6d 25 21 38 3d 2d 73 | transform%!8=-s| 00000710 25 20 3a 20 74 72 61 6e 73 66 6f 72 6d 25 21 31 |% : transform%!1| 00000720 32 3d 63 25 0d 00 3c 06 20 e1 0d 00 3d 04 0d ff |2=c%..<. ...=...| 00000730