Home » Recent acquisitions » Acorn ADFS disks » adfs_AcornUser_199801_2.adf » Features » DiffDim/Triangle2

DiffDim/Triangle2

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_AcornUser_199801_2.adf » Features
Filename: DiffDim/Triangle2
Read OK:
File size: 0ADF bytes
Load address: 0000
Exec address: 0000
File contents
   10REM Triangle 2
   20REM
   30REM Demonstrate gouraud shading
   40:
   50ON ERROR MODE0:PRINT REPORT$;" at line ";ERL:END
   60MODE 15:MODE 12:OFF
   70FORn%=0 TO 15
   80COLOUR n%,n%*n%*1.13333,n%*n%*1.13333,n%<<4
   90NEXT
  100DIM x%(2),y%(2),c(2),dither(1,1)
  110dither()=0.33,0.66,0.66,0.33
  120FORn%=0 TO 2
  130x%(n%)=RND(80):y%(n%)=RND(64):c(n%)=RND(1)
  140NEXT
  150bk%=1
  160PROCtriangle
  170PROCtriangle
  180MOUSE ON
  190REPEAT
  200REPEAT
  210MOUSE x%,y%,b%
  220UNTIL b%
  230IF b% AND 2 END
  240:
  250REM Find nearest vertex clicked
  260min_dist%=10:k%=-1
  270mx%=(x%-8) DIV 16:my%=(y%-8) DIV 16
  280FORn%=0 TO 2
  290dx%=x%(n%)-mx%:dy%=y%(n%)-my%
  300d%=dx%*dx%+dy%*dy%
  310IF d%<min_dist% min_dist%=d%:k%=n%
  320NEXT
  330:
  340REM If found, modify coordinates
  350IF k%>-1 THEN
  360  REPEAT
  370  MOUSE x%,y%,bu%
  380  x%(k%)=(x%-8) DIV 16
  390  y%(k%)=(y%-8) DIV 16
  400  PROCtriangle
  410  UNTIL bu%<>b%
  420ELSE
  430REM Else check for colour bar click
  440k%=-1
  450FORn%=0 TO 2
  460IF x%>n%*32 AND x%<(n%+1)*32 THEN k%=n%:n%=2
  470NEXT
  480IF k%>-1 THEN
  490  REPEAT
  500    MOUSE x%,y%,bu%
  510    c(k%)=y%/1024
  520    PROCtriangle
  530  UNTIL bu%<>b%
  540ENDIF
  550ENDIF
  560:
  570UNTIL FALSE
  580END
  590:
  600DEFPROCtriangle
  610SYS"OS_Byte",112,bk%
  620bk%=3-bk%
  630WAIT
  640SYS"OS_Byte",113,bk%
  650CLS
  660:
  670REM Draw in intensity bars
  680GCOL 15
  690FORn%=0 TO 2
  700RECTANGLE FILL n%*32,0,24,c(n%)*1024
  710NEXT
  720:
  730REM Find lowest y coordinate
  740min%=1024:i%=-1
  750FORn%=0 TO 2
  760IF y%(n%)<min% min%=y%(n%):i%=n%
  770NEXT
  780:
  790REM Find left and right coordinates
  800g%=(i%+1) MOD 3:h%=(g%+1) MOD 3
  810IF x%(g%)*y%(h%)+x%(h%)*y%(i%)+x%(i%)*y%(g%)<x%(g%)*y%(i%)+x%(h%)*y%(g%)+x%(i%)*y%(h%) THEN l%=g%:r%=h% ELSE l%=h%:r%=g%
  820:
  830left_x=x%(i%)+0.5:right_x=x%(i%)+0.5
  840left_c=c(i%):right_c=c(i%)
  850dly%=y%(l%)-y%(i%)
  860IF dly%>0 THEN left_g=(x%(l%)-x%(i%))/dly%:leftc_g=(c(l%)-c(i%))/dly% ELSE left_g=0:leftc_g=0:left_x=x%(l%)+0.5:left_c=c(l%)
  870dry%=y%(r%)-y%(i%)
  880IF dry%>0 THEN right_g=(x%(r%)-x%(i%))/dry%:rightc_g=(c(r%)-c(i%))/dry% ELSE right_g=0:rightc_g=0:right_x=x%(r%)+0.5:right_c=c(r%)
  890IF y%(l%)<y%(r%) THEN p%=l%:flag%=0 ELSE p%=r%:flag%=1
  900FOR y%=y%(i%) TO y%(p%)-1
  910PROCline(y%,left_x,right_x)
  920left_x+=left_g:right_x+=right_g
  930left_c+=leftc_g:right_c+=rightc_g
  940NEXT
  950CASE flag% OF
  960WHEN 0 : left_x=x%(l%):q%=r%:dly%=y%(r%)-y%(l%):IF dly%>0 left_g=(x%(r%)-x%(l%))/dly%:leftc_g=(c(r%)-c(l%))/dly%
  970WHEN 1 : right_x=x%(r%):q%=l%:dry%=y%(l%)-y%(r%):IF dry%>0 right_g=(x%(l%)-x%(r%))/dry%:rightc_g=(c(l%)-c(r%))/dry%
  980ENDCASE
  990FORy%=y%(p%) TO y%(q%)
 1000PROCline(y%,left_x,right_x)
 1010left_x+=left_g:right_x+=right_g
 1020left_c+=leftc_g:right_c+=rightc_g
 1030NEXT
 1040:
 1050REM Outline triangle
 1060GCOL 15
 1070LINE x%(0)*16+8,y%(0)*16+8,x%(1)*16+8,y%(1)*16+8:DRAW x%(2)*16+8,y%(2)*16+8:DRAW x%(0)*16+8,y%(0)*16+8
 1080CIRCLE x%(0)*16+8,y%(0)*16+8,16
 1090CIRCLE x%(1)*16+8,y%(1)*16+8,16
 1100CIRCLE x%(2)*16+8,y%(2)*16+8,16
 1110ENDPROC
 1120:
 1130DEFPROCline(y%,sx%,ex%)
 1140c=left_c:IF ex%>sx% dc=(right_c-left_c)/(ex%-sx%) ELSE dc=0
 1150FORx%=sx% TO ex%
 1160GCOL 15*c+dither(x% AND 1,y% AND 1)
 1170RECTANGLE FILL x%*16,y%*16,16,16
 1180c+=dc
 1190NEXT
 1200ENDPROC

� Triangle 2
�
!� Demonstrate gouraud shading
(:
2� � �0:� �$;" at line ";�:�
<� 15:� 12:�
F�n%=0 � 15
P*� n%,n%*n%*1.13333,n%*n%*1.13333,n%<<4
Z�
d"� x%(2),y%(2),c(2),dither(1,1)
n dither()=0.33,0.66,0.66,0.33
x
�n%=0 � 2
�(x%(n%)=�(80):y%(n%)=�(64):c(n%)=�(1)
��
�	bk%=1
�
�triangle
�
�triangle
�ȗ �
��
��
�ȗ x%,y%,b%
�� b%
�� b% � 2 �
�:
�!� Find nearest vertex clicked
min_dist%=10:k%=-1
#mx%=(x%-8) � 16:my%=(y%-8) � 16

�n%=0 � 2
"!dx%=x%(n%)-mx%:dy%=y%(n%)-my%
,d%=dx%*dx%+dy%*dy%
6%� d%<min_dist% min_dist%=d%:k%=n%
@�
J:
T"� If found, modify coordinates
^
� k%>-1 �
h  �
r  ȗ x%,y%,bu%
|  x%(k%)=(x%-8) � 16
�  y%(k%)=(y%-8) � 16
�  �triangle
�  � bu%<>b%
��
�%� Else check for colour bar click
�	k%=-1
�
�n%=0 � 2
�*� x%>n%*32 � x%<(n%+1)*32 � k%=n%:n%=2
��
�
� k%>-1 �
�  �
�    ȗ x%,y%,bu%
�    c(k%)=y%/1024
    �triangle
  � bu%<>b%
�
&�
0:
:� �
D�
N:
X��triangle
bș"OS_Byte",112,bk%
l
bk%=3-bk%
vȖ
�ș"OS_Byte",113,bk%
��
�:
�� Draw in intensity bars
�� 15
�
�n%=0 � 2
�ȓ Ȑ n%*32,0,24,c(n%)*1024
��
�:
�� Find lowest y coordinate
�min%=1024:i%=-1
�
�n%=0 � 2
�#� y%(n%)<min% min%=y%(n%):i%=n%
�
:
%� Find left and right coordinates
 g%=(i%+1) � 3:h%=(g%+1) � 3
*u� x%(g%)*y%(h%)+x%(h%)*y%(i%)+x%(i%)*y%(g%)<x%(g%)*y%(i%)+x%(h%)*y%(g%)+x%(i%)*y%(h%) � l%=g%:r%=h% � l%=h%:r%=g%
4:
>(left_x=x%(i%)+0.5:right_x=x%(i%)+0.5
Hleft_c=c(i%):right_c=c(i%)
Rdly%=y%(l%)-y%(i%)
\y� dly%>0 � left_g=(x%(l%)-x%(i%))/dly%:leftc_g=(c(l%)-c(i%))/dly% � left_g=0:leftc_g=0:left_x=x%(l%)+0.5:left_c=c(l%)
fdry%=y%(r%)-y%(i%)
p� dry%>0 � right_g=(x%(r%)-x%(i%))/dry%:rightc_g=(c(r%)-c(i%))/dry% � right_g=0:rightc_g=0:right_x=x%(r%)+0.5:right_c=c(r%)
z3� y%(l%)<y%(r%) � p%=l%:flag%=0 � p%=r%:flag%=1
�� y%=y%(i%) � y%(p%)-1
��line(y%,left_x,right_x)
�#left_x+=left_g:right_x+=right_g
�%left_c+=leftc_g:right_c+=rightc_g
��
�Ȏ flag% �
�p� 0 : left_x=x%(l%):q%=r%:dly%=y%(r%)-y%(l%):� dly%>0 left_g=(x%(r%)-x%(l%))/dly%:leftc_g=(c(r%)-c(l%))/dly%
�s� 1 : right_x=x%(r%):q%=l%:dry%=y%(l%)-y%(r%):� dry%>0 right_g=(x%(l%)-x%(r%))/dry%:rightc_g=(c(l%)-c(r%))/dry%
��
��y%=y%(p%) � y%(q%)
��line(y%,left_x,right_x)
�#left_x+=left_g:right_x+=right_g
�%left_c+=leftc_g:right_c+=rightc_g
�
:
� Outline triangle
$� 15
.a� x%(0)*16+8,y%(0)*16+8,x%(1)*16+8,y%(1)*16+8:� x%(2)*16+8,y%(2)*16+8:� x%(0)*16+8,y%(0)*16+8
8ȏ x%(0)*16+8,y%(0)*16+8,16
Bȏ x%(1)*16+8,y%(1)*16+8,16
Lȏ x%(2)*16+8,y%(2)*16+8,16
V�
`:
j��line(y%,sx%,ex%)
t;c=left_c:� ex%>sx% dc=(right_c-left_c)/(ex%-sx%) � dc=0
~�x%=sx% � ex%
� � 15*c+dither(x% � 1,y% � 1)
�ȓ Ȑ x%*16,y%*16,16,16
�	c+=dc
��
��
�
00000000  0d 00 0a 10 f4 20 54 72  69 61 6e 67 6c 65 20 32  |..... Triangle 2|
00000010  0d 00 14 05 f4 0d 00 1e  21 f4 20 44 65 6d 6f 6e  |........!. Demon|
00000020  73 74 72 61 74 65 20 67  6f 75 72 61 75 64 20 73  |strate gouraud s|
00000030  68 61 64 69 6e 67 0d 00  28 05 3a 0d 00 32 1f ee  |hading..(.:..2..|
00000040  20 85 20 eb 30 3a f1 20  f6 24 3b 22 20 61 74 20  | . .0:. .$;" at |
00000050  6c 69 6e 65 20 22 3b 9e  3a e0 0d 00 3c 0f eb 20  |line ";.:...<.. |
00000060  31 35 3a eb 20 31 32 3a  87 0d 00 46 0e e3 6e 25  |15:. 12:...F..n%|
00000070  3d 30 20 b8 20 31 35 0d  00 50 2a fb 20 6e 25 2c  |=0 . 15..P*. n%,|
00000080  6e 25 2a 6e 25 2a 31 2e  31 33 33 33 33 2c 6e 25  |n%*n%*1.13333,n%|
00000090  2a 6e 25 2a 31 2e 31 33  33 33 33 2c 6e 25 3c 3c  |*n%*1.13333,n%<<|
000000a0  34 0d 00 5a 05 ed 0d 00  64 22 de 20 78 25 28 32  |4..Z....d". x%(2|
000000b0  29 2c 79 25 28 32 29 2c  63 28 32 29 2c 64 69 74  |),y%(2),c(2),dit|
000000c0  68 65 72 28 31 2c 31 29  0d 00 6e 20 64 69 74 68  |her(1,1)..n dith|
000000d0  65 72 28 29 3d 30 2e 33  33 2c 30 2e 36 36 2c 30  |er()=0.33,0.66,0|
000000e0  2e 36 36 2c 30 2e 33 33  0d 00 78 0d e3 6e 25 3d  |.66,0.33..x..n%=|
000000f0  30 20 b8 20 32 0d 00 82  28 78 25 28 6e 25 29 3d  |0 . 2...(x%(n%)=|
00000100  b3 28 38 30 29 3a 79 25  28 6e 25 29 3d b3 28 36  |.(80):y%(n%)=.(6|
00000110  34 29 3a 63 28 6e 25 29  3d b3 28 31 29 0d 00 8c  |4):c(n%)=.(1)...|
00000120  05 ed 0d 00 96 09 62 6b  25 3d 31 0d 00 a0 0d f2  |......bk%=1.....|
00000130  74 72 69 61 6e 67 6c 65  0d 00 aa 0d f2 74 72 69  |triangle.....tri|
00000140  61 6e 67 6c 65 0d 00 b4  08 c8 97 20 ee 0d 00 be  |angle...... ....|
00000150  05 f5 0d 00 c8 05 f5 0d  00 d2 0f c8 97 20 78 25  |............. x%|
00000160  2c 79 25 2c 62 25 0d 00  dc 08 fd 20 62 25 0d 00  |,y%,b%..... b%..|
00000170  e6 0e e7 20 62 25 20 80  20 32 20 e0 0d 00 f0 05  |... b% . 2 .....|
00000180  3a 0d 00 fa 21 f4 20 46  69 6e 64 20 6e 65 61 72  |:...!. Find near|
00000190  65 73 74 20 76 65 72 74  65 78 20 63 6c 69 63 6b  |est vertex click|
000001a0  65 64 0d 01 04 16 6d 69  6e 5f 64 69 73 74 25 3d  |ed....min_dist%=|
000001b0  31 30 3a 6b 25 3d 2d 31  0d 01 0e 23 6d 78 25 3d  |10:k%=-1...#mx%=|
000001c0  28 78 25 2d 38 29 20 81  20 31 36 3a 6d 79 25 3d  |(x%-8) . 16:my%=|
000001d0  28 79 25 2d 38 29 20 81  20 31 36 0d 01 18 0d e3  |(y%-8) . 16.....|
000001e0  6e 25 3d 30 20 b8 20 32  0d 01 22 21 64 78 25 3d  |n%=0 . 2.."!dx%=|
000001f0  78 25 28 6e 25 29 2d 6d  78 25 3a 64 79 25 3d 79  |x%(n%)-mx%:dy%=y|
00000200  25 28 6e 25 29 2d 6d 79  25 0d 01 2c 16 64 25 3d  |%(n%)-my%..,.d%=|
00000210  64 78 25 2a 64 78 25 2b  64 79 25 2a 64 79 25 0d  |dx%*dx%+dy%*dy%.|
00000220  01 36 25 e7 20 64 25 3c  6d 69 6e 5f 64 69 73 74  |.6%. d%<min_dist|
00000230  25 20 6d 69 6e 5f 64 69  73 74 25 3d 64 25 3a 6b  |% min_dist%=d%:k|
00000240  25 3d 6e 25 0d 01 40 05  ed 0d 01 4a 05 3a 0d 01  |%=n%..@....J.:..|
00000250  54 22 f4 20 49 66 20 66  6f 75 6e 64 2c 20 6d 6f  |T". If found, mo|
00000260  64 69 66 79 20 63 6f 6f  72 64 69 6e 61 74 65 73  |dify coordinates|
00000270  0d 01 5e 0d e7 20 6b 25  3e 2d 31 20 8c 0d 01 68  |..^.. k%>-1 ...h|
00000280  07 20 20 f5 0d 01 72 12  20 20 c8 97 20 78 25 2c  |.  ...r.  .. x%,|
00000290  79 25 2c 62 75 25 0d 01  7c 18 20 20 78 25 28 6b  |y%,bu%..|.  x%(k|
000002a0  25 29 3d 28 78 25 2d 38  29 20 81 20 31 36 0d 01  |%)=(x%-8) . 16..|
000002b0  86 18 20 20 79 25 28 6b  25 29 3d 28 79 25 2d 38  |..  y%(k%)=(y%-8|
000002c0  29 20 81 20 31 36 0d 01  90 0f 20 20 f2 74 72 69  |) . 16....  .tri|
000002d0  61 6e 67 6c 65 0d 01 9a  0f 20 20 fd 20 62 75 25  |angle....  . bu%|
000002e0  3c 3e 62 25 0d 01 a4 05  cc 0d 01 ae 25 f4 20 45  |<>b%........%. E|
000002f0  6c 73 65 20 63 68 65 63  6b 20 66 6f 72 20 63 6f  |lse check for co|
00000300  6c 6f 75 72 20 62 61 72  20 63 6c 69 63 6b 0d 01  |lour bar click..|
00000310  b8 09 6b 25 3d 2d 31 0d  01 c2 0d e3 6e 25 3d 30  |..k%=-1.....n%=0|
00000320  20 b8 20 32 0d 01 cc 2a  e7 20 78 25 3e 6e 25 2a  | . 2...*. x%>n%*|
00000330  33 32 20 80 20 78 25 3c  28 6e 25 2b 31 29 2a 33  |32 . x%<(n%+1)*3|
00000340  32 20 8c 20 6b 25 3d 6e  25 3a 6e 25 3d 32 0d 01  |2 . k%=n%:n%=2..|
00000350  d6 05 ed 0d 01 e0 0d e7  20 6b 25 3e 2d 31 20 8c  |........ k%>-1 .|
00000360  0d 01 ea 07 20 20 f5 0d  01 f4 14 20 20 20 20 c8  |....  .....    .|
00000370  97 20 78 25 2c 79 25 2c  62 75 25 0d 01 fe 15 20  |. x%,y%,bu%.... |
00000380  20 20 20 63 28 6b 25 29  3d 79 25 2f 31 30 32 34  |   c(k%)=y%/1024|
00000390  0d 02 08 11 20 20 20 20  f2 74 72 69 61 6e 67 6c  |....    .triangl|
000003a0  65 0d 02 12 0f 20 20 fd  20 62 75 25 3c 3e 62 25  |e....  . bu%<>b%|
000003b0  0d 02 1c 05 cd 0d 02 26  05 cd 0d 02 30 05 3a 0d  |.......&....0.:.|
000003c0  02 3a 07 fd 20 a3 0d 02  44 05 e0 0d 02 4e 05 3a  |.:.. ...D....N.:|
000003d0  0d 02 58 0e dd f2 74 72  69 61 6e 67 6c 65 0d 02  |..X...triangle..|
000003e0  62 17 c8 99 22 4f 53 5f  42 79 74 65 22 2c 31 31  |b..."OS_Byte",11|
000003f0  32 2c 62 6b 25 0d 02 6c  0d 62 6b 25 3d 33 2d 62  |2,bk%..l.bk%=3-b|
00000400  6b 25 0d 02 76 06 c8 96  0d 02 80 17 c8 99 22 4f  |k%..v........."O|
00000410  53 5f 42 79 74 65 22 2c  31 31 33 2c 62 6b 25 0d  |S_Byte",113,bk%.|
00000420  02 8a 05 db 0d 02 94 05  3a 0d 02 9e 1c f4 20 44  |........:..... D|
00000430  72 61 77 20 69 6e 20 69  6e 74 65 6e 73 69 74 79  |raw in intensity|
00000440  20 62 61 72 73 0d 02 a8  08 e6 20 31 35 0d 02 b2  | bars..... 15...|
00000450  0d e3 6e 25 3d 30 20 b8  20 32 0d 02 bc 1f c8 93  |..n%=0 . 2......|
00000460  20 c8 90 20 6e 25 2a 33  32 2c 30 2c 32 34 2c 63  | .. n%*32,0,24,c|
00000470  28 6e 25 29 2a 31 30 32  34 0d 02 c6 05 ed 0d 02  |(n%)*1024.......|
00000480  d0 05 3a 0d 02 da 1e f4  20 46 69 6e 64 20 6c 6f  |..:..... Find lo|
00000490  77 65 73 74 20 79 20 63  6f 6f 72 64 69 6e 61 74  |west y coordinat|
000004a0  65 0d 02 e4 13 6d 69 6e  25 3d 31 30 32 34 3a 69  |e....min%=1024:i|
000004b0  25 3d 2d 31 0d 02 ee 0d  e3 6e 25 3d 30 20 b8 20  |%=-1.....n%=0 . |
000004c0  32 0d 02 f8 23 e7 20 79  25 28 6e 25 29 3c 6d 69  |2...#. y%(n%)<mi|
000004d0  6e 25 20 6d 69 6e 25 3d  79 25 28 6e 25 29 3a 69  |n% min%=y%(n%):i|
000004e0  25 3d 6e 25 0d 03 02 05  ed 0d 03 0c 05 3a 0d 03  |%=n%.........:..|
000004f0  16 25 f4 20 46 69 6e 64  20 6c 65 66 74 20 61 6e  |.%. Find left an|
00000500  64 20 72 69 67 68 74 20  63 6f 6f 72 64 69 6e 61  |d right coordina|
00000510  74 65 73 0d 03 20 1f 67  25 3d 28 69 25 2b 31 29  |tes.. .g%=(i%+1)|
00000520  20 83 20 33 3a 68 25 3d  28 67 25 2b 31 29 20 83  | . 3:h%=(g%+1) .|
00000530  20 33 0d 03 2a 75 e7 20  78 25 28 67 25 29 2a 79  | 3..*u. x%(g%)*y|
00000540  25 28 68 25 29 2b 78 25  28 68 25 29 2a 79 25 28  |%(h%)+x%(h%)*y%(|
00000550  69 25 29 2b 78 25 28 69  25 29 2a 79 25 28 67 25  |i%)+x%(i%)*y%(g%|
00000560  29 3c 78 25 28 67 25 29  2a 79 25 28 69 25 29 2b  |)<x%(g%)*y%(i%)+|
00000570  78 25 28 68 25 29 2a 79  25 28 67 25 29 2b 78 25  |x%(h%)*y%(g%)+x%|
00000580  28 69 25 29 2a 79 25 28  68 25 29 20 8c 20 6c 25  |(i%)*y%(h%) . l%|
00000590  3d 67 25 3a 72 25 3d 68  25 20 8b 20 6c 25 3d 68  |=g%:r%=h% . l%=h|
000005a0  25 3a 72 25 3d 67 25 0d  03 34 05 3a 0d 03 3e 28  |%:r%=g%..4.:..>(|
000005b0  6c 65 66 74 5f 78 3d 78  25 28 69 25 29 2b 30 2e  |left_x=x%(i%)+0.|
000005c0  35 3a 72 69 67 68 74 5f  78 3d 78 25 28 69 25 29  |5:right_x=x%(i%)|
000005d0  2b 30 2e 35 0d 03 48 1e  6c 65 66 74 5f 63 3d 63  |+0.5..H.left_c=c|
000005e0  28 69 25 29 3a 72 69 67  68 74 5f 63 3d 63 28 69  |(i%):right_c=c(i|
000005f0  25 29 0d 03 52 16 64 6c  79 25 3d 79 25 28 6c 25  |%)..R.dly%=y%(l%|
00000600  29 2d 79 25 28 69 25 29  0d 03 5c 79 e7 20 64 6c  |)-y%(i%)..\y. dl|
00000610  79 25 3e 30 20 8c 20 6c  65 66 74 5f 67 3d 28 78  |y%>0 . left_g=(x|
00000620  25 28 6c 25 29 2d 78 25  28 69 25 29 29 2f 64 6c  |%(l%)-x%(i%))/dl|
00000630  79 25 3a 6c 65 66 74 63  5f 67 3d 28 63 28 6c 25  |y%:leftc_g=(c(l%|
00000640  29 2d 63 28 69 25 29 29  2f 64 6c 79 25 20 8b 20  |)-c(i%))/dly% . |
00000650  6c 65 66 74 5f 67 3d 30  3a 6c 65 66 74 63 5f 67  |left_g=0:leftc_g|
00000660  3d 30 3a 6c 65 66 74 5f  78 3d 78 25 28 6c 25 29  |=0:left_x=x%(l%)|
00000670  2b 30 2e 35 3a 6c 65 66  74 5f 63 3d 63 28 6c 25  |+0.5:left_c=c(l%|
00000680  29 0d 03 66 16 64 72 79  25 3d 79 25 28 72 25 29  |)..f.dry%=y%(r%)|
00000690  2d 79 25 28 69 25 29 0d  03 70 7f e7 20 64 72 79  |-y%(i%)..p.. dry|
000006a0  25 3e 30 20 8c 20 72 69  67 68 74 5f 67 3d 28 78  |%>0 . right_g=(x|
000006b0  25 28 72 25 29 2d 78 25  28 69 25 29 29 2f 64 72  |%(r%)-x%(i%))/dr|
000006c0  79 25 3a 72 69 67 68 74  63 5f 67 3d 28 63 28 72  |y%:rightc_g=(c(r|
000006d0  25 29 2d 63 28 69 25 29  29 2f 64 72 79 25 20 8b  |%)-c(i%))/dry% .|
000006e0  20 72 69 67 68 74 5f 67  3d 30 3a 72 69 67 68 74  | right_g=0:right|
000006f0  63 5f 67 3d 30 3a 72 69  67 68 74 5f 78 3d 78 25  |c_g=0:right_x=x%|
00000700  28 72 25 29 2b 30 2e 35  3a 72 69 67 68 74 5f 63  |(r%)+0.5:right_c|
00000710  3d 63 28 72 25 29 0d 03  7a 33 e7 20 79 25 28 6c  |=c(r%)..z3. y%(l|
00000720  25 29 3c 79 25 28 72 25  29 20 8c 20 70 25 3d 6c  |%)<y%(r%) . p%=l|
00000730  25 3a 66 6c 61 67 25 3d  30 20 8b 20 70 25 3d 72  |%:flag%=0 . p%=r|
00000740  25 3a 66 6c 61 67 25 3d  31 0d 03 84 1a e3 20 79  |%:flag%=1..... y|
00000750  25 3d 79 25 28 69 25 29  20 b8 20 79 25 28 70 25  |%=y%(i%) . y%(p%|
00000760  29 2d 31 0d 03 8e 1c f2  6c 69 6e 65 28 79 25 2c  |)-1.....line(y%,|
00000770  6c 65 66 74 5f 78 2c 72  69 67 68 74 5f 78 29 0d  |left_x,right_x).|
00000780  03 98 23 6c 65 66 74 5f  78 2b 3d 6c 65 66 74 5f  |..#left_x+=left_|
00000790  67 3a 72 69 67 68 74 5f  78 2b 3d 72 69 67 68 74  |g:right_x+=right|
000007a0  5f 67 0d 03 a2 25 6c 65  66 74 5f 63 2b 3d 6c 65  |_g...%left_c+=le|
000007b0  66 74 63 5f 67 3a 72 69  67 68 74 5f 63 2b 3d 72  |ftc_g:right_c+=r|
000007c0  69 67 68 74 63 5f 67 0d  03 ac 05 ed 0d 03 b6 0e  |ightc_g.........|
000007d0  c8 8e 20 66 6c 61 67 25  20 ca 0d 03 c0 70 c9 20  |.. flag% ....p. |
000007e0  30 20 3a 20 6c 65 66 74  5f 78 3d 78 25 28 6c 25  |0 : left_x=x%(l%|
000007f0  29 3a 71 25 3d 72 25 3a  64 6c 79 25 3d 79 25 28  |):q%=r%:dly%=y%(|
00000800  72 25 29 2d 79 25 28 6c  25 29 3a e7 20 64 6c 79  |r%)-y%(l%):. dly|
00000810  25 3e 30 20 6c 65 66 74  5f 67 3d 28 78 25 28 72  |%>0 left_g=(x%(r|
00000820  25 29 2d 78 25 28 6c 25  29 29 2f 64 6c 79 25 3a  |%)-x%(l%))/dly%:|
00000830  6c 65 66 74 63 5f 67 3d  28 63 28 72 25 29 2d 63  |leftc_g=(c(r%)-c|
00000840  28 6c 25 29 29 2f 64 6c  79 25 0d 03 ca 73 c9 20  |(l%))/dly%...s. |
00000850  31 20 3a 20 72 69 67 68  74 5f 78 3d 78 25 28 72  |1 : right_x=x%(r|
00000860  25 29 3a 71 25 3d 6c 25  3a 64 72 79 25 3d 79 25  |%):q%=l%:dry%=y%|
00000870  28 6c 25 29 2d 79 25 28  72 25 29 3a e7 20 64 72  |(l%)-y%(r%):. dr|
00000880  79 25 3e 30 20 72 69 67  68 74 5f 67 3d 28 78 25  |y%>0 right_g=(x%|
00000890  28 6c 25 29 2d 78 25 28  72 25 29 29 2f 64 72 79  |(l%)-x%(r%))/dry|
000008a0  25 3a 72 69 67 68 74 63  5f 67 3d 28 63 28 6c 25  |%:rightc_g=(c(l%|
000008b0  29 2d 63 28 72 25 29 29  2f 64 72 79 25 0d 03 d4  |)-c(r%))/dry%...|
000008c0  05 cb 0d 03 de 17 e3 79  25 3d 79 25 28 70 25 29  |.......y%=y%(p%)|
000008d0  20 b8 20 79 25 28 71 25  29 0d 03 e8 1c f2 6c 69  | . y%(q%).....li|
000008e0  6e 65 28 79 25 2c 6c 65  66 74 5f 78 2c 72 69 67  |ne(y%,left_x,rig|
000008f0  68 74 5f 78 29 0d 03 f2  23 6c 65 66 74 5f 78 2b  |ht_x)...#left_x+|
00000900  3d 6c 65 66 74 5f 67 3a  72 69 67 68 74 5f 78 2b  |=left_g:right_x+|
00000910  3d 72 69 67 68 74 5f 67  0d 03 fc 25 6c 65 66 74  |=right_g...%left|
00000920  5f 63 2b 3d 6c 65 66 74  63 5f 67 3a 72 69 67 68  |_c+=leftc_g:righ|
00000930  74 5f 63 2b 3d 72 69 67  68 74 63 5f 67 0d 04 06  |t_c+=rightc_g...|
00000940  05 ed 0d 04 10 05 3a 0d  04 1a 16 f4 20 4f 75 74  |......:..... Out|
00000950  6c 69 6e 65 20 74 72 69  61 6e 67 6c 65 0d 04 24  |line triangle..$|
00000960  08 e6 20 31 35 0d 04 2e  61 86 20 78 25 28 30 29  |.. 15...a. x%(0)|
00000970  2a 31 36 2b 38 2c 79 25  28 30 29 2a 31 36 2b 38  |*16+8,y%(0)*16+8|
00000980  2c 78 25 28 31 29 2a 31  36 2b 38 2c 79 25 28 31  |,x%(1)*16+8,y%(1|
00000990  29 2a 31 36 2b 38 3a df  20 78 25 28 32 29 2a 31  |)*16+8:. x%(2)*1|
000009a0  36 2b 38 2c 79 25 28 32  29 2a 31 36 2b 38 3a df  |6+8,y%(2)*16+8:.|
000009b0  20 78 25 28 30 29 2a 31  36 2b 38 2c 79 25 28 30  | x%(0)*16+8,y%(0|
000009c0  29 2a 31 36 2b 38 0d 04  38 1f c8 8f 20 78 25 28  |)*16+8..8... x%(|
000009d0  30 29 2a 31 36 2b 38 2c  79 25 28 30 29 2a 31 36  |0)*16+8,y%(0)*16|
000009e0  2b 38 2c 31 36 0d 04 42  1f c8 8f 20 78 25 28 31  |+8,16..B... x%(1|
000009f0  29 2a 31 36 2b 38 2c 79  25 28 31 29 2a 31 36 2b  |)*16+8,y%(1)*16+|
00000a00  38 2c 31 36 0d 04 4c 1f  c8 8f 20 78 25 28 32 29  |8,16..L... x%(2)|
00000a10  2a 31 36 2b 38 2c 79 25  28 32 29 2a 31 36 2b 38  |*16+8,y%(2)*16+8|
00000a20  2c 31 36 0d 04 56 05 e1  0d 04 60 05 3a 0d 04 6a  |,16..V....`.:..j|
00000a30  16 dd f2 6c 69 6e 65 28  79 25 2c 73 78 25 2c 65  |...line(y%,sx%,e|
00000a40  78 25 29 0d 04 74 3b 63  3d 6c 65 66 74 5f 63 3a  |x%)..t;c=left_c:|
00000a50  e7 20 65 78 25 3e 73 78  25 20 64 63 3d 28 72 69  |. ex%>sx% dc=(ri|
00000a60  67 68 74 5f 63 2d 6c 65  66 74 5f 63 29 2f 28 65  |ght_c-left_c)/(e|
00000a70  78 25 2d 73 78 25 29 20  8b 20 64 63 3d 30 0d 04  |x%-sx%) . dc=0..|
00000a80  7e 11 e3 78 25 3d 73 78  25 20 b8 20 65 78 25 0d  |~..x%=sx% . ex%.|
00000a90  04 88 20 e6 20 31 35 2a  63 2b 64 69 74 68 65 72  |.. . 15*c+dither|
00000aa0  28 78 25 20 80 20 31 2c  79 25 20 80 20 31 29 0d  |(x% . 1,y% . 1).|
00000ab0  04 92 1b c8 93 20 c8 90  20 78 25 2a 31 36 2c 79  |..... .. x%*16,y|
00000ac0  25 2a 31 36 2c 31 36 2c  31 36 0d 04 9c 09 63 2b  |%*16,16,16....c+|
00000ad0  3d 64 63 0d 04 a6 05 ed  0d 04 b0 05 e1 0d ff     |=dc............|
00000adf