Home » Archimedes archive » Acorn Computing » 1994 03.adf » 9403 » Draw/Example2
Draw/Example2
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 Computing » 1994 03.adf » 9403 |
Filename: | Draw/Example2 |
Read OK: | ✔ |
File size: | 0C0D bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
10REM > Example2 20 30REM The draw module - Example 2 40REM Demonstrate transformation matrices 50REM by Ben Summers 60 70 80ONERROR REPORT:PRINT" at line "ERL:END 90@% = &020208 100 110MODE 12 120 130 140REM first, make a path... 150 160RESTORE 170DIM path% 1024 180 190n = 0 200REPEAT 210 READ e% 220 path%!(n*4) = e% 230 n += 1 240UNTIL e% = -1 250 260DATA 2,0,0, 8,46080,0, 8,46080,46080, 8,0,46080, 8,0,0, 4 270DATA 2,34560,43200, 8,43200,43200, 8,43200,34560, 4, 0, -1 280 290 300DIM transform% 32 310 320 330CLS 340ORIGIN 640,256 350 360PRINT "Select transformation type..." 370PRINT " 1 Enlarge" 380PRINT " 2 Enlarge and rotate" 390PRINT " 3 Enlarge and shear, x-axis invariant" 400PRINT " 4 Enlarge and shear, y-axis invariant" 410PRINT " 5 Enlarge and reflect" 420PRINT 430 440REPEAT 450 INPUT "? " type% 460UNTIL type% > 0 AND type% < 6 470 480CLS 490 500INPUT "Enlargement factor? "m 510PRINT 520 530CASE type% OF 540 WHEN 1: PROCset_enlarge 550 WHEN 2: PROCset_rotate 560 WHEN 3: PROCset_shear_x 570 WHEN 4: PROCset_shear_y 580 WHEN 5: PROCset_reflect 590ENDCASE 600 610 620PRINT 630PRINT "GREEN: Untransformed path" 640PRINT "WHITE: Transformed path" 650IF type% = 5 PRINT "RED: Line the path is reflected in" 660PRINT 670 680PRINT "a = "a 690PRINT "b = "b 700PRINT "c = "c 710PRINT "d = "d 720 730 740REM set up a transformation matrix 750 760REM also take into account the user units... I'm using 256ths of an inch here... 770 780REM plot that path 790SYS "ColourTrans_SetGCOL",&00FF0000,,,0,0 800PROCstroke_path(1, 0, 0, 1) 810 820IF type% = 5 THEN 830 SYS "ColourTrans_SetGCOL",&0000FF00,,,0,0 840 850 MOVE -640,n * -640 860 DRAW 640,n * 640 870ENDIF 880 890REM plot that path 900SYS "ColourTrans_SetGCOL",&FFFFFF00,,,0,0 910 920PROCstroke_path(a, b, c, d) 930 940 950END 960 970DEFPROCset_enlarge 980 a = m 990 b = 0 1000 c = 0 1010 d = m 1020 1030 PRINT "Enlargement" 1040ENDPROC 1050 1060DEFPROCset_rotate 1070 INPUT "Angle of rotation (anti-clockwise) in degrees? "theta 1080 1090 a = m * COSRADtheta 1100 b = m * SINRADtheta 1110 c = m * -SINRADtheta 1120 d = m * COSRADtheta 1130 1140 PRINT "Rotation by "theta" degrees" 1150ENDPROC 1160 1170DEFPROCset_shear_x 1180 INPUT "k so (0, 1) maps to (k, 1)? "k 1190 1200 a = m 1210 b = 0 1220 c = k * m 1230 d = m 1240 PRINT "Shear, x-axis invariant" 1250ENDPROC 1260 1270DEFPROCset_shear_y 1280 INPUT "k so (1, 0) maps to (1, k)? "k 1290 1300 a = m 1310 b = k * m 1320 c = 0 1330 d = m 1340 1350 PRINT "Shear, y-axis invariant" 1360ENDPROC 1370 1380DEFPROCset_reflect 1390 INPUT "Enter n to reflect in line y = nx? "n 1400 1410 theta = ATN n 1420 1430 REM no RAD's here as ATN returns the result in radians not degrees 1440 REM (all BASIC trig functions take the arguement in radian, so you 1450 REM use RAD to convert degree to radians) 1460 1470 a = m * COS(2 * theta) 1480 b = m * SIN(2 * theta) 1490 c = m * SIN(2 * theta) 1500 d = m * -COS(2 * theta) 1510 1520 PRINT "Reflection in line y = "n" x" 1530ENDPROC 1540 1550 1560DEFPROCstroke_path(a, b, c, d) 1570 REM I'm using internal draw units for my path elements. 1580 user_unit_scale = 1 1590 1600 transform%!0 = (user_unit_scale * a) * 2^16 1610 transform%!4 = (user_unit_scale * b) * 2^16 1620 transform%!8 = (user_unit_scale * c) * 2^16 1630 transform%!12 = (user_unit_scale * d) * 2^16 1640 transform%!16 = 0 1650 transform%!20 = 0 1660 1670 SYS "Draw_Stroke",path%,0,transform%,0,0,0,0 1680ENDPROC 1690 1700
� > Example2 !� The draw module - Example 2 ()� Demonstrate transformation matrices 2� by Ben Summers < F P� �:�" at line "�:� Z@% = &020208 d n� 12 x � �� first, make a path... � �� �� path% 1024 � � n = 0 �� � � e% � path%!(n*4) = e% � n += 1 � � e% = -1 � :� 2,0,0, 8,46080,0, 8,46080,46080, 8,0,46080, 8,0,0, 4 ;� 2,34560,43200, 8,43200,43200, 8,43200,34560, 4, 0, -1 " ,� transform% 32 6 @ J� Tȑ 640,256 ^ h%� "Select transformation type..." r� " 1 Enlarge" |� " 2 Enlarge and rotate" �0� " 3 Enlarge and shear, x-axis invariant" �0� " 4 Enlarge and shear, y-axis invariant" � � " 5 Enlarge and reflect" �� � �� � � "? " type% �� type% > 0 � type% < 6 � �� � �� "Enlargement factor? "m �� Ȏ type% � � 1: �set_enlarge & � 2: �set_rotate 0 � 3: �set_shear_x : � 4: �set_shear_y D � 5: �set_reflect N� X b l� v!� "GREEN: Untransformed path" �� "WHITE: Transformed path" �8� type% = 5 � "RED: Line the path is reflected in" �� � � � "a = "a � � "b = "b � � "c = "c � � "d = "d � � �$� set up a transformation matrix � �R� also take into account the user units... I'm using 256ths of an inch here... � plot that path ,ș "ColourTrans_SetGCOL",&00FF0000,,,0,0 �stroke_path(1, 0, 0, 1) * 4� type% = 5 � >. ș "ColourTrans_SetGCOL",&0000FF00,,,0,0 H R � -640,n * -640 \ � 640,n * 640 f� p z� plot that path �,ș "ColourTrans_SetGCOL",&FFFFFF00,,,0,0 � ��stroke_path(a, b, c, d) � � �� � ���set_enlarge � a = m � b = 0 � c = 0 � d = m � � "Enlargement" � $��set_rotate .> � "Angle of rotation (anti-clockwise) in degrees? "theta 8 B a = m * ��theta L b = m * ��theta V c = m * -��theta ` d = m * ��theta j t% � "Rotation by "theta" degrees" ~� � ���set_shear_x �' � "k so (0, 1) maps to (k, 1)? "k � � a = m � b = 0 � c = k * m � d = m �! � "Shear, x-axis invariant" �� � ���set_shear_y ' � "k so (1, 0) maps to (1, k)? "k a = m b = k * m ( c = 0 2 d = m < F! � "Shear, y-axis invariant" P� Z d��set_reflect n. � "Enter n to reflect in line y = nx? "n x � theta = � n � �F � no RAD's here as ATN returns the result in radians not degrees �F � (all BASIC trig functions take the arguement in radian, so you �- � use RAD to convert degree to radians) � � a = m * �(2 * theta) � b = m * �(2 * theta) � c = m * �(2 * theta) � d = m * -�(2 * theta) � �& � "Reflection in line y = "n" x" �� ��stroke_path(a, b, c, d) "< � I'm using internal draw units for my path elements. , user_unit_scale = 1 6 @2 transform%!0 = (user_unit_scale * a) * 2^16 J2 transform%!4 = (user_unit_scale * b) * 2^16 T2 transform%!8 = (user_unit_scale * c) * 2^16 ^2 transform%!12 = (user_unit_scale * d) * 2^16 h transform%!16 = 0 r transform%!20 = 0 | �1 ș "Draw_Stroke",path%,0,transform%,0,0,0,0 �� � � �
00000000 0d 00 0a 10 f4 20 3e 20 45 78 61 6d 70 6c 65 32 |..... > Example2| 00000010 0d 00 14 04 0d 00 1e 21 f4 20 54 68 65 20 64 72 |.......!. The dr| 00000020 61 77 20 6d 6f 64 75 6c 65 20 2d 20 45 78 61 6d |aw module - Exam| 00000030 70 6c 65 20 32 0d 00 28 29 f4 20 44 65 6d 6f 6e |ple 2..(). Demon| 00000040 73 74 72 61 74 65 20 74 72 61 6e 73 66 6f 72 6d |strate transform| 00000050 61 74 69 6f 6e 20 6d 61 74 72 69 63 65 73 0d 00 |ation matrices..| 00000060 32 14 f4 20 62 79 20 42 65 6e 20 53 75 6d 6d 65 |2.. by Ben Summe| 00000070 72 73 0d 00 3c 04 0d 00 46 04 0d 00 50 18 ee 85 |rs..<...F...P...| 00000080 20 f6 3a f1 22 20 61 74 20 6c 69 6e 65 20 22 9e | .:." at line ".| 00000090 3a e0 0d 00 5a 10 40 25 20 3d 20 26 30 32 30 32 |:...Z.@% = &0202| 000000a0 30 38 0d 00 64 04 0d 00 6e 08 eb 20 31 32 0d 00 |08..d...n.. 12..| 000000b0 78 04 0d 00 82 04 0d 00 8c 1b f4 20 66 69 72 73 |x.......... firs| 000000c0 74 2c 20 6d 61 6b 65 20 61 20 70 61 74 68 2e 2e |t, make a path..| 000000d0 2e 0d 00 96 04 0d 00 a0 05 f7 0d 00 aa 10 de 20 |............... | 000000e0 70 61 74 68 25 20 31 30 32 34 0d 00 b4 04 0d 00 |path% 1024......| 000000f0 be 09 6e 20 3d 20 30 0d 00 c8 05 f5 0d 00 d2 0a |..n = 0.........| 00000100 20 20 f3 20 65 25 0d 00 dc 16 20 20 70 61 74 68 | . e%.... path| 00000110 25 21 28 6e 2a 34 29 20 3d 20 65 25 0d 00 e6 0c |%!(n*4) = e%....| 00000120 20 20 6e 20 2b 3d 20 31 0d 00 f0 0d fd 20 65 25 | n += 1..... e%| 00000130 20 3d 20 2d 31 0d 00 fa 04 0d 01 04 3a dc 20 32 | = -1.......:. 2| 00000140 2c 30 2c 30 2c 20 38 2c 34 36 30 38 30 2c 30 2c |,0,0, 8,46080,0,| 00000150 20 38 2c 34 36 30 38 30 2c 34 36 30 38 30 2c 20 | 8,46080,46080, | 00000160 38 2c 30 2c 34 36 30 38 30 2c 20 38 2c 30 2c 30 |8,0,46080, 8,0,0| 00000170 2c 20 34 0d 01 0e 3b dc 20 32 2c 33 34 35 36 30 |, 4...;. 2,34560| 00000180 2c 34 33 32 30 30 2c 20 38 2c 34 33 32 30 30 2c |,43200, 8,43200,| 00000190 34 33 32 30 30 2c 20 38 2c 34 33 32 30 30 2c 33 |43200, 8,43200,3| 000001a0 34 35 36 30 2c 20 34 2c 20 30 2c 20 2d 31 0d 01 |4560, 4, 0, -1..| 000001b0 18 04 0d 01 22 04 0d 01 2c 13 de 20 74 72 61 6e |...."...,.. tran| 000001c0 73 66 6f 72 6d 25 20 33 32 0d 01 36 04 0d 01 40 |sform% 32..6...@| 000001d0 04 0d 01 4a 05 db 0d 01 54 0e c8 91 20 36 34 30 |...J....T... 640| 000001e0 2c 32 35 36 0d 01 5e 04 0d 01 68 25 f1 20 22 53 |,256..^...h%. "S| 000001f0 65 6c 65 63 74 20 74 72 61 6e 73 66 6f 72 6d 61 |elect transforma| 00000200 74 69 6f 6e 20 74 79 70 65 2e 2e 2e 22 0d 01 72 |tion type..."..r| 00000210 14 f1 20 22 20 20 31 20 20 45 6e 6c 61 72 67 65 |.. " 1 Enlarge| 00000220 22 0d 01 7c 1f f1 20 22 20 20 32 20 20 45 6e 6c |"..|.. " 2 Enl| 00000230 61 72 67 65 20 61 6e 64 20 72 6f 74 61 74 65 22 |arge and rotate"| 00000240 0d 01 86 30 f1 20 22 20 20 33 20 20 45 6e 6c 61 |...0. " 3 Enla| 00000250 72 67 65 20 61 6e 64 20 73 68 65 61 72 2c 20 78 |rge and shear, x| 00000260 2d 61 78 69 73 20 69 6e 76 61 72 69 61 6e 74 22 |-axis invariant"| 00000270 0d 01 90 30 f1 20 22 20 20 34 20 20 45 6e 6c 61 |...0. " 4 Enla| 00000280 72 67 65 20 61 6e 64 20 73 68 65 61 72 2c 20 79 |rge and shear, y| 00000290 2d 61 78 69 73 20 69 6e 76 61 72 69 61 6e 74 22 |-axis invariant"| 000002a0 0d 01 9a 20 f1 20 22 20 20 35 20 20 45 6e 6c 61 |... . " 5 Enla| 000002b0 72 67 65 20 61 6e 64 20 72 65 66 6c 65 63 74 22 |rge and reflect"| 000002c0 0d 01 a4 05 f1 0d 01 ae 04 0d 01 b8 05 f5 0d 01 |................| 000002d0 c2 12 20 20 e8 20 22 3f 20 22 20 74 79 70 65 25 |.. . "? " type%| 000002e0 0d 01 cc 1b fd 20 74 79 70 65 25 20 3e 20 30 20 |..... type% > 0 | 000002f0 80 20 74 79 70 65 25 20 3c 20 36 0d 01 d6 04 0d |. type% < 6.....| 00000300 01 e0 05 db 0d 01 ea 04 0d 01 f4 1d e8 20 22 45 |............. "E| 00000310 6e 6c 61 72 67 65 6d 65 6e 74 20 66 61 63 74 6f |nlargement facto| 00000320 72 3f 20 22 6d 0d 01 fe 05 f1 0d 02 08 04 0d 02 |r? "m...........| 00000330 12 0e c8 8e 20 74 79 70 65 25 20 ca 0d 02 1c 17 |.... type% .....| 00000340 20 20 c9 20 31 3a 20 f2 73 65 74 5f 65 6e 6c 61 | . 1: .set_enla| 00000350 72 67 65 0d 02 26 16 20 20 c9 20 32 3a 20 f2 73 |rge..&. . 2: .s| 00000360 65 74 5f 72 6f 74 61 74 65 0d 02 30 17 20 20 c9 |et_rotate..0. .| 00000370 20 33 3a 20 f2 73 65 74 5f 73 68 65 61 72 5f 78 | 3: .set_shear_x| 00000380 0d 02 3a 17 20 20 c9 20 34 3a 20 f2 73 65 74 5f |..:. . 4: .set_| 00000390 73 68 65 61 72 5f 79 0d 02 44 17 20 20 c9 20 35 |shear_y..D. . 5| 000003a0 3a 20 f2 73 65 74 5f 72 65 66 6c 65 63 74 0d 02 |: .set_reflect..| 000003b0 4e 05 cb 0d 02 58 04 0d 02 62 04 0d 02 6c 05 f1 |N....X...b...l..| 000003c0 0d 02 76 21 f1 20 22 47 52 45 45 4e 3a 20 55 6e |..v!. "GREEN: Un| 000003d0 74 72 61 6e 73 66 6f 72 6d 65 64 20 70 61 74 68 |transformed path| 000003e0 22 0d 02 80 1f f1 20 22 57 48 49 54 45 3a 20 54 |"..... "WHITE: T| 000003f0 72 61 6e 73 66 6f 72 6d 65 64 20 70 61 74 68 22 |ransformed path"| 00000400 0d 02 8a 38 e7 20 74 79 70 65 25 20 3d 20 35 20 |...8. type% = 5 | 00000410 f1 20 22 52 45 44 3a 20 20 20 4c 69 6e 65 20 74 |. "RED: Line t| 00000420 68 65 20 70 61 74 68 20 69 73 20 72 65 66 6c 65 |he path is refle| 00000430 63 74 65 64 20 69 6e 22 0d 02 94 05 f1 0d 02 9e |cted in"........| 00000440 04 0d 02 a8 0d f1 20 22 61 20 3d 20 22 61 0d 02 |...... "a = "a..| 00000450 b2 0d f1 20 22 62 20 3d 20 22 62 0d 02 bc 0d f1 |... "b = "b.....| 00000460 20 22 63 20 3d 20 22 63 0d 02 c6 0d f1 20 22 64 | "c = "c..... "d| 00000470 20 3d 20 22 64 0d 02 d0 04 0d 02 da 04 0d 02 e4 | = "d...........| 00000480 24 f4 20 73 65 74 20 75 70 20 61 20 74 72 61 6e |$. set up a tran| 00000490 73 66 6f 72 6d 61 74 69 6f 6e 20 6d 61 74 72 69 |sformation matri| 000004a0 78 0d 02 ee 04 0d 02 f8 52 f4 20 61 6c 73 6f 20 |x.......R. also | 000004b0 74 61 6b 65 20 69 6e 74 6f 20 61 63 63 6f 75 6e |take into accoun| 000004c0 74 20 74 68 65 20 75 73 65 72 20 75 6e 69 74 73 |t the user units| 000004d0 2e 2e 2e 20 49 27 6d 20 75 73 69 6e 67 20 32 35 |... I'm using 25| 000004e0 36 74 68 73 20 6f 66 20 61 6e 20 69 6e 63 68 20 |6ths of an inch | 000004f0 68 65 72 65 2e 2e 2e 0d 03 02 04 0d 03 0c 14 f4 |here............| 00000500 20 70 6c 6f 74 20 74 68 61 74 20 70 61 74 68 0d | plot that path.| 00000510 03 16 2c c8 99 20 22 43 6f 6c 6f 75 72 54 72 61 |..,.. "ColourTra| 00000520 6e 73 5f 53 65 74 47 43 4f 4c 22 2c 26 30 30 46 |ns_SetGCOL",&00F| 00000530 46 30 30 30 30 2c 2c 2c 30 2c 30 0d 03 20 1c f2 |F0000,,,0,0.. ..| 00000540 73 74 72 6f 6b 65 5f 70 61 74 68 28 31 2c 20 30 |stroke_path(1, 0| 00000550 2c 20 30 2c 20 31 29 0d 03 2a 04 0d 03 34 11 e7 |, 0, 1)..*...4..| 00000560 20 74 79 70 65 25 20 3d 20 35 20 8c 0d 03 3e 2e | type% = 5 ...>.| 00000570 20 20 c8 99 20 22 43 6f 6c 6f 75 72 54 72 61 6e | .. "ColourTran| 00000580 73 5f 53 65 74 47 43 4f 4c 22 2c 26 30 30 30 30 |s_SetGCOL",&0000| 00000590 46 46 30 30 2c 2c 2c 30 2c 30 0d 03 48 04 0d 03 |FF00,,,0,0..H...| 000005a0 52 15 20 20 ec 20 2d 36 34 30 2c 6e 20 2a 20 2d |R. . -640,n * -| 000005b0 36 34 30 0d 03 5c 13 20 20 df 20 36 34 30 2c 6e |640..\. . 640,n| 000005c0 20 2a 20 36 34 30 0d 03 66 05 cd 0d 03 70 04 0d | * 640..f....p..| 000005d0 03 7a 14 f4 20 70 6c 6f 74 20 74 68 61 74 20 70 |.z.. plot that p| 000005e0 61 74 68 0d 03 84 2c c8 99 20 22 43 6f 6c 6f 75 |ath...,.. "Colou| 000005f0 72 54 72 61 6e 73 5f 53 65 74 47 43 4f 4c 22 2c |rTrans_SetGCOL",| 00000600 26 46 46 46 46 46 46 30 30 2c 2c 2c 30 2c 30 0d |&FFFFFF00,,,0,0.| 00000610 03 8e 04 0d 03 98 1c f2 73 74 72 6f 6b 65 5f 70 |........stroke_p| 00000620 61 74 68 28 61 2c 20 62 2c 20 63 2c 20 64 29 0d |ath(a, b, c, d).| 00000630 03 a2 04 0d 03 ac 04 0d 03 b6 05 e0 0d 03 c0 04 |................| 00000640 0d 03 ca 11 dd f2 73 65 74 5f 65 6e 6c 61 72 67 |......set_enlarg| 00000650 65 0d 03 d4 0b 20 20 61 20 3d 20 6d 0d 03 de 0b |e.... a = m....| 00000660 20 20 62 20 3d 20 30 0d 03 e8 0b 20 20 63 20 3d | b = 0.... c =| 00000670 20 30 0d 03 f2 0b 20 20 64 20 3d 20 6d 0d 03 fc | 0.... d = m...| 00000680 04 0d 04 06 15 20 20 f1 20 22 45 6e 6c 61 72 67 |..... . "Enlarg| 00000690 65 6d 65 6e 74 22 0d 04 10 05 e1 0d 04 1a 04 0d |ement"..........| 000006a0 04 24 10 dd f2 73 65 74 5f 72 6f 74 61 74 65 0d |.$...set_rotate.| 000006b0 04 2e 3e 20 20 e8 20 22 41 6e 67 6c 65 20 6f 66 |..> . "Angle of| 000006c0 20 72 6f 74 61 74 69 6f 6e 20 28 61 6e 74 69 2d | rotation (anti-| 000006d0 63 6c 6f 63 6b 77 69 73 65 29 20 69 6e 20 64 65 |clockwise) in de| 000006e0 67 72 65 65 73 3f 20 22 74 68 65 74 61 0d 04 38 |grees? "theta..8| 000006f0 04 0d 04 42 15 20 20 61 20 3d 20 6d 20 2a 20 9b |...B. a = m * .| 00000700 b2 74 68 65 74 61 0d 04 4c 15 20 20 62 20 3d 20 |.theta..L. b = | 00000710 6d 20 2a 20 b5 b2 74 68 65 74 61 0d 04 56 16 20 |m * ..theta..V. | 00000720 20 63 20 3d 20 6d 20 2a 20 2d b5 b2 74 68 65 74 | c = m * -..thet| 00000730 61 0d 04 60 15 20 20 64 20 3d 20 6d 20 2a 20 9b |a..`. d = m * .| 00000740 b2 74 68 65 74 61 0d 04 6a 04 0d 04 74 25 20 20 |.theta..j...t% | 00000750 f1 20 22 52 6f 74 61 74 69 6f 6e 20 62 79 20 22 |. "Rotation by "| 00000760 74 68 65 74 61 22 20 64 65 67 72 65 65 73 22 0d |theta" degrees".| 00000770 04 7e 05 e1 0d 04 88 04 0d 04 92 11 dd f2 73 65 |.~............se| 00000780 74 5f 73 68 65 61 72 5f 78 0d 04 9c 27 20 20 e8 |t_shear_x...' .| 00000790 20 22 6b 20 73 6f 20 28 30 2c 20 31 29 20 6d 61 | "k so (0, 1) ma| 000007a0 70 73 20 74 6f 20 28 6b 2c 20 31 29 3f 20 22 6b |ps to (k, 1)? "k| 000007b0 0d 04 a6 04 0d 04 b0 0b 20 20 61 20 3d 20 6d 0d |........ a = m.| 000007c0 04 ba 0b 20 20 62 20 3d 20 30 0d 04 c4 0f 20 20 |... b = 0.... | 000007d0 63 20 3d 20 6b 20 2a 20 6d 0d 04 ce 0b 20 20 64 |c = k * m.... d| 000007e0 20 3d 20 6d 0d 04 d8 21 20 20 f1 20 22 53 68 65 | = m...! . "She| 000007f0 61 72 2c 20 78 2d 61 78 69 73 20 69 6e 76 61 72 |ar, x-axis invar| 00000800 69 61 6e 74 22 0d 04 e2 05 e1 0d 04 ec 04 0d 04 |iant"...........| 00000810 f6 11 dd f2 73 65 74 5f 73 68 65 61 72 5f 79 0d |....set_shear_y.| 00000820 05 00 27 20 20 e8 20 22 6b 20 73 6f 20 28 31 2c |..' . "k so (1,| 00000830 20 30 29 20 6d 61 70 73 20 74 6f 20 28 31 2c 20 | 0) maps to (1, | 00000840 6b 29 3f 20 22 6b 0d 05 0a 04 0d 05 14 0b 20 20 |k)? "k........ | 00000850 61 20 3d 20 6d 0d 05 1e 0f 20 20 62 20 3d 20 6b |a = m.... b = k| 00000860 20 2a 20 6d 0d 05 28 0b 20 20 63 20 3d 20 30 0d | * m..(. c = 0.| 00000870 05 32 0b 20 20 64 20 3d 20 6d 0d 05 3c 04 0d 05 |.2. d = m..<...| 00000880 46 21 20 20 f1 20 22 53 68 65 61 72 2c 20 79 2d |F! . "Shear, y-| 00000890 61 78 69 73 20 69 6e 76 61 72 69 61 6e 74 22 0d |axis invariant".| 000008a0 05 50 05 e1 0d 05 5a 04 0d 05 64 11 dd f2 73 65 |.P....Z...d...se| 000008b0 74 5f 72 65 66 6c 65 63 74 0d 05 6e 2e 20 20 e8 |t_reflect..n. .| 000008c0 20 22 45 6e 74 65 72 20 6e 20 74 6f 20 72 65 66 | "Enter n to ref| 000008d0 6c 65 63 74 20 69 6e 20 6c 69 6e 65 20 79 20 3d |lect in line y =| 000008e0 20 6e 78 3f 20 22 6e 0d 05 78 04 0d 05 82 11 20 | nx? "n..x..... | 000008f0 20 74 68 65 74 61 20 3d 20 99 20 6e 0d 05 8c 04 | theta = . n....| 00000900 0d 05 96 46 20 20 f4 20 6e 6f 20 52 41 44 27 73 |...F . no RAD's| 00000910 20 68 65 72 65 20 61 73 20 41 54 4e 20 72 65 74 | here as ATN ret| 00000920 75 72 6e 73 20 74 68 65 20 72 65 73 75 6c 74 20 |urns the result | 00000930 69 6e 20 72 61 64 69 61 6e 73 20 6e 6f 74 20 64 |in radians not d| 00000940 65 67 72 65 65 73 0d 05 a0 46 20 20 f4 20 28 61 |egrees...F . (a| 00000950 6c 6c 20 42 41 53 49 43 20 74 72 69 67 20 66 75 |ll BASIC trig fu| 00000960 6e 63 74 69 6f 6e 73 20 74 61 6b 65 20 74 68 65 |nctions take the| 00000970 20 61 72 67 75 65 6d 65 6e 74 20 69 6e 20 72 61 | arguement in ra| 00000980 64 69 61 6e 2c 20 73 6f 20 79 6f 75 0d 05 aa 2d |dian, so you...-| 00000990 20 20 f4 20 75 73 65 20 52 41 44 20 74 6f 20 63 | . use RAD to c| 000009a0 6f 6e 76 65 72 74 20 64 65 67 72 65 65 20 74 6f |onvert degree to| 000009b0 20 72 61 64 69 61 6e 73 29 0d 05 b4 04 0d 05 be | radians).......| 000009c0 1a 20 20 61 20 3d 20 6d 20 2a 20 9b 28 32 20 2a |. a = m * .(2 *| 000009d0 20 74 68 65 74 61 29 0d 05 c8 1a 20 20 62 20 3d | theta).... b =| 000009e0 20 6d 20 2a 20 b5 28 32 20 2a 20 74 68 65 74 61 | m * .(2 * theta| 000009f0 29 0d 05 d2 1a 20 20 63 20 3d 20 6d 20 2a 20 b5 |).... c = m * .| 00000a00 28 32 20 2a 20 74 68 65 74 61 29 0d 05 dc 1b 20 |(2 * theta).... | 00000a10 20 64 20 3d 20 6d 20 2a 20 2d 9b 28 32 20 2a 20 | d = m * -.(2 * | 00000a20 74 68 65 74 61 29 0d 05 e6 04 0d 05 f0 26 20 20 |theta).......& | 00000a30 f1 20 22 52 65 66 6c 65 63 74 69 6f 6e 20 69 6e |. "Reflection in| 00000a40 20 6c 69 6e 65 20 79 20 3d 20 22 6e 22 20 78 22 | line y = "n" x"| 00000a50 0d 05 fa 05 e1 0d 06 04 04 0d 06 0e 04 0d 06 18 |................| 00000a60 1d dd f2 73 74 72 6f 6b 65 5f 70 61 74 68 28 61 |...stroke_path(a| 00000a70 2c 20 62 2c 20 63 2c 20 64 29 0d 06 22 3c 20 20 |, b, c, d).."< | 00000a80 f4 20 20 49 27 6d 20 75 73 69 6e 67 20 69 6e 74 |. I'm using int| 00000a90 65 72 6e 61 6c 20 64 72 61 77 20 75 6e 69 74 73 |ernal draw units| 00000aa0 20 66 6f 72 20 6d 79 20 70 61 74 68 20 65 6c 65 | for my path ele| 00000ab0 6d 65 6e 74 73 2e 0d 06 2c 19 20 20 75 73 65 72 |ments...,. user| 00000ac0 5f 75 6e 69 74 5f 73 63 61 6c 65 20 3d 20 31 0d |_unit_scale = 1.| 00000ad0 06 36 04 0d 06 40 32 20 20 74 72 61 6e 73 66 6f |.6...@2 transfo| 00000ae0 72 6d 25 21 30 20 20 3d 20 28 75 73 65 72 5f 75 |rm%!0 = (user_u| 00000af0 6e 69 74 5f 73 63 61 6c 65 20 2a 20 61 29 20 2a |nit_scale * a) *| 00000b00 20 32 5e 31 36 0d 06 4a 32 20 20 74 72 61 6e 73 | 2^16..J2 trans| 00000b10 66 6f 72 6d 25 21 34 20 20 3d 20 28 75 73 65 72 |form%!4 = (user| 00000b20 5f 75 6e 69 74 5f 73 63 61 6c 65 20 2a 20 62 29 |_unit_scale * b)| 00000b30 20 2a 20 32 5e 31 36 0d 06 54 32 20 20 74 72 61 | * 2^16..T2 tra| 00000b40 6e 73 66 6f 72 6d 25 21 38 20 20 3d 20 28 75 73 |nsform%!8 = (us| 00000b50 65 72 5f 75 6e 69 74 5f 73 63 61 6c 65 20 2a 20 |er_unit_scale * | 00000b60 63 29 20 2a 20 32 5e 31 36 0d 06 5e 32 20 20 74 |c) * 2^16..^2 t| 00000b70 72 61 6e 73 66 6f 72 6d 25 21 31 32 20 3d 20 28 |ransform%!12 = (| 00000b80 75 73 65 72 5f 75 6e 69 74 5f 73 63 61 6c 65 20 |user_unit_scale | 00000b90 2a 20 64 29 20 2a 20 32 5e 31 36 0d 06 68 17 20 |* d) * 2^16..h. | 00000ba0 20 74 72 61 6e 73 66 6f 72 6d 25 21 31 36 20 3d | transform%!16 =| 00000bb0 20 30 0d 06 72 17 20 20 74 72 61 6e 73 66 6f 72 | 0..r. transfor| 00000bc0 6d 25 21 32 30 20 3d 20 30 0d 06 7c 04 0d 06 86 |m%!20 = 0..|....| 00000bd0 31 20 20 c8 99 20 22 44 72 61 77 5f 53 74 72 6f |1 .. "Draw_Stro| 00000be0 6b 65 22 2c 70 61 74 68 25 2c 30 2c 74 72 61 6e |ke",path%,0,tran| 00000bf0 73 66 6f 72 6d 25 2c 30 2c 30 2c 30 2c 30 0d 06 |sform%,0,0,0,0..| 00000c00 90 05 e1 0d 06 9a 04 0d 06 a4 04 0d ff |.............| 00000c0d