Home » Archimedes archive » Acorn User » AU 1998-08.adf » Regulars » StarInfo/Brobecker/SprngSrfc

StarInfo/Brobecker/SprngSrfc

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 1998-08.adf » Regulars
Filename: StarInfo/Brobecker/SprngSrfc
Read OK:
File size: 0833 bytes
Load address: 0000
Exec address: 0000
File contents
   10REM>>> Spring system, with surface conservation
   20REM    Alain BROBECKER (baah/Arm's Tech) on 07-Feb-1998
   30MODE9:OFF:ORIGIN640,512
   40m%=24:n%=m%-1 :REMnb of points
   50r=128       :REMradius of object
   60k=0.8       :REMsprings' stiffness
   70sk=30       :REMsurface' stiffness
   80a=.93       :REMabsorption
   90g=-0.8      :REMgravity
  100ga=0        :REMgravity angle
  110w%=256      :REMwall position
  120DIMx(n%),y(n%),vx(n%),vy(n%),ax(n%),ay(n%)
  130vx()=0:vy()=0
  140REMcreate object, compute springs' neutral length and object neutral surface
  150FORc%=0TOn%:x(c%)=r*COS(2*PI*c%/m%):y(c%)=r*SIN(2*PI*c%/m%):NEXT
  160nl=SQR((x(1)-x(0))^2+(y(1)-y(0))^2) :REMsprings' neutral length
  170ns=FNsurface
  180
  190b%=1        :REMscreenbank
  200REPEAT
  210 WAIT:SYS"OS_Byte",&71,b%:b%=b%EOR3:SYS"OS_Byte",&70,b%:CLS
  220 GCOL4:RECTANGLE-w%-1,-w%-1,w%+3<<1,w%+3<<1
  230 GCOL1:MOVEx(0),y(0):FORc%=1TOn%:DRAWx(c%),y(c%):NEXT:DRAWx(0),y(0)
  240 GCOL7:FORc%=0TOn%:POINTx(c%),y(c%):NEXTc%
  250REMmodify gravity an put it into acceleration
  260 l=g*COSga:ax()=l:l=g*SINga:ay()=l:ga+=0.05
  270 IFRND(128)<3THENga+=PI
  280REMcompute surface and add forces according to s-ns
  290 s=FNsurface
  300 fs=sk*(s-ns)/ns
  310 FORc%=0TOn%
  320  d%=c%-1:IFd%<0THENd%=n%
  330  e%=(c%+1)MODm%
  340  dx=y(d%)-y(e%)        :REMvector normal to d%e%
  350  dy=x(e%)-x(d%)
  360  l=SQR(dx^2+dy^2)
  370  IFl<>0THEN
  380   ax(c%)+=fs*dx/l
  390   ay(c%)+=fs*dy/l
  400  ENDIF
  410 NEXTc% 
  420REMcompute force for each spring
  430 FORc%=0TOn%
  440  d%=(c%+1)MODm%
  450  dx=x(c%)-x(d%)
  460  dy=y(c%)-y(d%)
  470  l=SQR(dx^2+dy^2)
  480  IFl<>0THEN
  490   ax=(nl-l)*k*dx/l
  500   ay=(nl-l)*k*dy/l
  510   ax(c%)+=ax:ax(d%)-=ax
  520   ay(c%)+=ay:ay(d%)-=ay
  530  ENDIF
  540 NEXT
  550REMcompute movements for each point
  560 FORc%=0TOn%
  570  vx(c%)=vx(c%)*a+ax(c%)
  580  vy(c%)=(vy(c%)-ay(c%))*a+2*ay(c%) :REMno absorption of gravity
  590  x(c%)+=vx(c%)
  600  y(c%)+=vy(c%)
  610  IFx(c%)<-w%THENx(c%)=-w%:vx(c%)=-vx(c%)
  620  IFx(c%)>w%THENx(c%)=w%:vx(c%)=-vx(c%)
  630  IFy(c%)<-w%THENy(c%)=-w%:vy(c%)=-vy(c%)
  640  IFy(c%)>w%THENy(c%)=w%:vy(c%)=-vy(c%)
  650 NEXT
  660UNTILFALSE
  670
  680REMThis function returns the surface under the polygonal curve.
  690DEFFNsurface
  700LOCALs,c%,d%
  710 s=0.5*(y(n%)+y(0))*(x(n%)-x(0))
  720 FORd%=1TOn%
  730  c%=d%-1
  740  s+=0.5*(y(c%)+y(d%))*(x(c%)-x(d%))
  750 NEXT
  760=s

1�>>> Spring system, with surface conservation
9�    Alain BROBECKER (baah/Arm's Tech) on 07-Feb-1998
�9:�:ȑ640,512
( m%=24:n%=m%-1 :�nb of points
2"r=128       :�radius of object
<$k=0.8       :�springs' stiffness
F$sk=30       :�surface' stiffness
Pa=.93       :�absorption
Zg=-0.8      :�gravity
dga=0        :�gravity angle
nw%=256      :�wall position
x,�x(n%),y(n%),vx(n%),vy(n%),ax(n%),ay(n%)
�vx()=0:vy()=0
�N�create object, compute springs' neutral length and object neutral surface
�8�c%=0�n%:x(c%)=r*�(2*�*c%/m%):y(c%)=r*�(2*�*c%/m%):�
�?nl=�((x(1)-x(0))^2+(y(1)-y(0))^2) :�springs' neutral length
�ns=�surface
�
�b%=1        :�screenbank
��
�7 Ȗ:ș"OS_Byte",&71,b%:b%=b%�3:ș"OS_Byte",&70,b%:�
�% �4:ȓ-w%-1,-w%-1,w%+3<<1,w%+3<<1
�5 �1:�x(0),y(0):�c%=1�n%:�x(c%),y(c%):�:�x(0),y(0)
�" �7:�c%=0�n%:Ȓx(c%),y(c%):�c%
�/�modify gravity an put it into acceleration
+ l=g*�ga:ax()=l:l=g*�ga:ay()=l:ga+=0.05
 �(128)<3�ga+=�
5�compute surface and add forces according to s-ns
" s=�surface
, fs=sk*(s-ns)/ns
6
 �c%=0�n%
@  d%=c%-1:�d%<0�d%=n%
J  e%=(c%+1)�m%
T3  dx=y(d%)-y(e%)        :�vector normal to d%e%
^  dy=x(e%)-x(d%)
h  l=�(dx^2+dy^2)
r  �l<>0�
|   ax(c%)+=fs*dx/l
�   ay(c%)+=fs*dy/l
�  �
�	 �c% 
�"�compute force for each spring
�
 �c%=0�n%
�  d%=(c%+1)�m%
�  dx=x(c%)-x(d%)
�  dy=y(c%)-y(d%)
�  l=�(dx^2+dy^2)
�  �l<>0�
�   ax=(nl-l)*k*dx/l
�   ay=(nl-l)*k*dy/l
�   ax(c%)+=ax:ax(d%)-=ax
   ay(c%)+=ay:ay(d%)-=ay
  �
 �
&%�compute movements for each point
0
 �c%=0�n%
:  vx(c%)=vx(c%)*a+ax(c%)
DB  vy(c%)=(vy(c%)-ay(c%))*a+2*ay(c%) :�no absorption of gravity
N  x(c%)+=vx(c%)
X  y(c%)+=vy(c%)
b)  �x(c%)<-w%�x(c%)=-w%:vx(c%)=-vx(c%)
l'  �x(c%)>w%�x(c%)=w%:vx(c%)=-vx(c%)
v)  �y(c%)<-w%�y(c%)=-w%:vy(c%)=-vy(c%)
�'  �y(c%)>w%�y(c%)=w%:vy(c%)=-vy(c%)
� �
���
�
�A�This function returns the surface under the polygonal curve.
�
ݤsurface
��s,c%,d%
�$ s=0.5*(y(n%)+y(0))*(x(n%)-x(0))
�
 �d%=1�n%
�
  c%=d%-1
�(  s+=0.5*(y(c%)+y(d%))*(x(c%)-x(d%))
� �
�=s
�
00000000  0d 00 0a 31 f4 3e 3e 3e  20 53 70 72 69 6e 67 20  |...1.>>> Spring |
00000010  73 79 73 74 65 6d 2c 20  77 69 74 68 20 73 75 72  |system, with sur|
00000020  66 61 63 65 20 63 6f 6e  73 65 72 76 61 74 69 6f  |face conservatio|
00000030  6e 0d 00 14 39 f4 20 20  20 20 41 6c 61 69 6e 20  |n...9.    Alain |
00000040  42 52 4f 42 45 43 4b 45  52 20 28 62 61 61 68 2f  |BROBECKER (baah/|
00000050  41 72 6d 27 73 20 54 65  63 68 29 20 6f 6e 20 30  |Arm's Tech) on 0|
00000060  37 2d 46 65 62 2d 31 39  39 38 0d 00 1e 12 eb 39  |7-Feb-1998.....9|
00000070  3a 87 3a c8 91 36 34 30  2c 35 31 32 0d 00 28 20  |:.:..640,512..( |
00000080  6d 25 3d 32 34 3a 6e 25  3d 6d 25 2d 31 20 3a f4  |m%=24:n%=m%-1 :.|
00000090  6e 62 20 6f 66 20 70 6f  69 6e 74 73 0d 00 32 22  |nb of points..2"|
000000a0  72 3d 31 32 38 20 20 20  20 20 20 20 3a f4 72 61  |r=128       :.ra|
000000b0  64 69 75 73 20 6f 66 20  6f 62 6a 65 63 74 0d 00  |dius of object..|
000000c0  3c 24 6b 3d 30 2e 38 20  20 20 20 20 20 20 3a f4  |<$k=0.8       :.|
000000d0  73 70 72 69 6e 67 73 27  20 73 74 69 66 66 6e 65  |springs' stiffne|
000000e0  73 73 0d 00 46 24 73 6b  3d 33 30 20 20 20 20 20  |ss..F$sk=30     |
000000f0  20 20 3a f4 73 75 72 66  61 63 65 27 20 73 74 69  |  :.surface' sti|
00000100  66 66 6e 65 73 73 0d 00  50 1c 61 3d 2e 39 33 20  |ffness..P.a=.93 |
00000110  20 20 20 20 20 20 3a f4  61 62 73 6f 72 70 74 69  |      :.absorpti|
00000120  6f 6e 0d 00 5a 19 67 3d  2d 30 2e 38 20 20 20 20  |on..Z.g=-0.8    |
00000130  20 20 3a f4 67 72 61 76  69 74 79 0d 00 64 1f 67  |  :.gravity..d.g|
00000140  61 3d 30 20 20 20 20 20  20 20 20 3a f4 67 72 61  |a=0        :.gra|
00000150  76 69 74 79 20 61 6e 67  6c 65 0d 00 6e 1f 77 25  |vity angle..n.w%|
00000160  3d 32 35 36 20 20 20 20  20 20 3a f4 77 61 6c 6c  |=256      :.wall|
00000170  20 70 6f 73 69 74 69 6f  6e 0d 00 78 2c de 78 28  | position..x,.x(|
00000180  6e 25 29 2c 79 28 6e 25  29 2c 76 78 28 6e 25 29  |n%),y(n%),vx(n%)|
00000190  2c 76 79 28 6e 25 29 2c  61 78 28 6e 25 29 2c 61  |,vy(n%),ax(n%),a|
000001a0  79 28 6e 25 29 0d 00 82  11 76 78 28 29 3d 30 3a  |y(n%)....vx()=0:|
000001b0  76 79 28 29 3d 30 0d 00  8c 4e f4 63 72 65 61 74  |vy()=0...N.creat|
000001c0  65 20 6f 62 6a 65 63 74  2c 20 63 6f 6d 70 75 74  |e object, comput|
000001d0  65 20 73 70 72 69 6e 67  73 27 20 6e 65 75 74 72  |e springs' neutr|
000001e0  61 6c 20 6c 65 6e 67 74  68 20 61 6e 64 20 6f 62  |al length and ob|
000001f0  6a 65 63 74 20 6e 65 75  74 72 61 6c 20 73 75 72  |ject neutral sur|
00000200  66 61 63 65 0d 00 96 38  e3 63 25 3d 30 b8 6e 25  |face...8.c%=0.n%|
00000210  3a 78 28 63 25 29 3d 72  2a 9b 28 32 2a af 2a 63  |:x(c%)=r*.(2*.*c|
00000220  25 2f 6d 25 29 3a 79 28  63 25 29 3d 72 2a b5 28  |%/m%):y(c%)=r*.(|
00000230  32 2a af 2a 63 25 2f 6d  25 29 3a ed 0d 00 a0 3f  |2*.*c%/m%):....?|
00000240  6e 6c 3d b6 28 28 78 28  31 29 2d 78 28 30 29 29  |nl=.((x(1)-x(0))|
00000250  5e 32 2b 28 79 28 31 29  2d 79 28 30 29 29 5e 32  |^2+(y(1)-y(0))^2|
00000260  29 20 3a f4 73 70 72 69  6e 67 73 27 20 6e 65 75  |) :.springs' neu|
00000270  74 72 61 6c 20 6c 65 6e  67 74 68 0d 00 aa 0f 6e  |tral length....n|
00000280  73 3d a4 73 75 72 66 61  63 65 0d 00 b4 04 0d 00  |s=.surface......|
00000290  be 1c 62 25 3d 31 20 20  20 20 20 20 20 20 3a f4  |..b%=1        :.|
000002a0  73 63 72 65 65 6e 62 61  6e 6b 0d 00 c8 05 f5 0d  |screenbank......|
000002b0  00 d2 37 20 c8 96 3a c8  99 22 4f 53 5f 42 79 74  |..7 ..:.."OS_Byt|
000002c0  65 22 2c 26 37 31 2c 62  25 3a 62 25 3d 62 25 82  |e",&71,b%:b%=b%.|
000002d0  33 3a c8 99 22 4f 53 5f  42 79 74 65 22 2c 26 37  |3:.."OS_Byte",&7|
000002e0  30 2c 62 25 3a db 0d 00  dc 25 20 e6 34 3a c8 93  |0,b%:....% .4:..|
000002f0  2d 77 25 2d 31 2c 2d 77  25 2d 31 2c 77 25 2b 33  |-w%-1,-w%-1,w%+3|
00000300  3c 3c 31 2c 77 25 2b 33  3c 3c 31 0d 00 e6 35 20  |<<1,w%+3<<1...5 |
00000310  e6 31 3a ec 78 28 30 29  2c 79 28 30 29 3a e3 63  |.1:.x(0),y(0):.c|
00000320  25 3d 31 b8 6e 25 3a df  78 28 63 25 29 2c 79 28  |%=1.n%:.x(c%),y(|
00000330  63 25 29 3a ed 3a df 78  28 30 29 2c 79 28 30 29  |c%):.:.x(0),y(0)|
00000340  0d 00 f0 22 20 e6 37 3a  e3 63 25 3d 30 b8 6e 25  |..." .7:.c%=0.n%|
00000350  3a c8 92 78 28 63 25 29  2c 79 28 63 25 29 3a ed  |:..x(c%),y(c%):.|
00000360  63 25 0d 00 fa 2f f4 6d  6f 64 69 66 79 20 67 72  |c%.../.modify gr|
00000370  61 76 69 74 79 20 61 6e  20 70 75 74 20 69 74 20  |avity an put it |
00000380  69 6e 74 6f 20 61 63 63  65 6c 65 72 61 74 69 6f  |into acceleratio|
00000390  6e 0d 01 04 2b 20 6c 3d  67 2a 9b 67 61 3a 61 78  |n...+ l=g*.ga:ax|
000003a0  28 29 3d 6c 3a 6c 3d 67  2a b5 67 61 3a 61 79 28  |()=l:l=g*.ga:ay(|
000003b0  29 3d 6c 3a 67 61 2b 3d  30 2e 30 35 0d 01 0e 14  |)=l:ga+=0.05....|
000003c0  20 e7 b3 28 31 32 38 29  3c 33 8c 67 61 2b 3d af  | ..(128)<3.ga+=.|
000003d0  0d 01 18 35 f4 63 6f 6d  70 75 74 65 20 73 75 72  |...5.compute sur|
000003e0  66 61 63 65 20 61 6e 64  20 61 64 64 20 66 6f 72  |face and add for|
000003f0  63 65 73 20 61 63 63 6f  72 64 69 6e 67 20 74 6f  |ces according to|
00000400  20 73 2d 6e 73 0d 01 22  0f 20 73 3d a4 73 75 72  | s-ns..". s=.sur|
00000410  66 61 63 65 0d 01 2c 14  20 66 73 3d 73 6b 2a 28  |face..,. fs=sk*(|
00000420  73 2d 6e 73 29 2f 6e 73  0d 01 36 0d 20 e3 63 25  |s-ns)/ns..6. .c%|
00000430  3d 30 b8 6e 25 0d 01 40  19 20 20 64 25 3d 63 25  |=0.n%..@.  d%=c%|
00000440  2d 31 3a e7 64 25 3c 30  8c 64 25 3d 6e 25 0d 01  |-1:.d%<0.d%=n%..|
00000450  4a 12 20 20 65 25 3d 28  63 25 2b 31 29 83 6d 25  |J.  e%=(c%+1).m%|
00000460  0d 01 54 33 20 20 64 78  3d 79 28 64 25 29 2d 79  |..T3  dx=y(d%)-y|
00000470  28 65 25 29 20 20 20 20  20 20 20 20 3a f4 76 65  |(e%)        :.ve|
00000480  63 74 6f 72 20 6e 6f 72  6d 61 6c 20 74 6f 20 64  |ctor normal to d|
00000490  25 65 25 0d 01 5e 14 20  20 64 79 3d 78 28 65 25  |%e%..^.  dy=x(e%|
000004a0  29 2d 78 28 64 25 29 0d  01 68 14 20 20 6c 3d b6  |)-x(d%)..h.  l=.|
000004b0  28 64 78 5e 32 2b 64 79  5e 32 29 0d 01 72 0c 20  |(dx^2+dy^2)..r. |
000004c0  20 e7 6c 3c 3e 30 8c 0d  01 7c 16 20 20 20 61 78  | .l<>0...|.   ax|
000004d0  28 63 25 29 2b 3d 66 73  2a 64 78 2f 6c 0d 01 86  |(c%)+=fs*dx/l...|
000004e0  16 20 20 20 61 79 28 63  25 29 2b 3d 66 73 2a 64  |.   ay(c%)+=fs*d|
000004f0  79 2f 6c 0d 01 90 07 20  20 cd 0d 01 9a 09 20 ed  |y/l....  ..... .|
00000500  63 25 20 0d 01 a4 22 f4  63 6f 6d 70 75 74 65 20  |c% ...".compute |
00000510  66 6f 72 63 65 20 66 6f  72 20 65 61 63 68 20 73  |force for each s|
00000520  70 72 69 6e 67 0d 01 ae  0d 20 e3 63 25 3d 30 b8  |pring.... .c%=0.|
00000530  6e 25 0d 01 b8 12 20 20  64 25 3d 28 63 25 2b 31  |n%....  d%=(c%+1|
00000540  29 83 6d 25 0d 01 c2 14  20 20 64 78 3d 78 28 63  |).m%....  dx=x(c|
00000550  25 29 2d 78 28 64 25 29  0d 01 cc 14 20 20 64 79  |%)-x(d%)....  dy|
00000560  3d 79 28 63 25 29 2d 79  28 64 25 29 0d 01 d6 14  |=y(c%)-y(d%)....|
00000570  20 20 6c 3d b6 28 64 78  5e 32 2b 64 79 5e 32 29  |  l=.(dx^2+dy^2)|
00000580  0d 01 e0 0c 20 20 e7 6c  3c 3e 30 8c 0d 01 ea 17  |....  .l<>0.....|
00000590  20 20 20 61 78 3d 28 6e  6c 2d 6c 29 2a 6b 2a 64  |   ax=(nl-l)*k*d|
000005a0  78 2f 6c 0d 01 f4 17 20  20 20 61 79 3d 28 6e 6c  |x/l....   ay=(nl|
000005b0  2d 6c 29 2a 6b 2a 64 79  2f 6c 0d 01 fe 1c 20 20  |-l)*k*dy/l....  |
000005c0  20 61 78 28 63 25 29 2b  3d 61 78 3a 61 78 28 64  | ax(c%)+=ax:ax(d|
000005d0  25 29 2d 3d 61 78 0d 02  08 1c 20 20 20 61 79 28  |%)-=ax....   ay(|
000005e0  63 25 29 2b 3d 61 79 3a  61 79 28 64 25 29 2d 3d  |c%)+=ay:ay(d%)-=|
000005f0  61 79 0d 02 12 07 20 20  cd 0d 02 1c 06 20 ed 0d  |ay....  ..... ..|
00000600  02 26 25 f4 63 6f 6d 70  75 74 65 20 6d 6f 76 65  |.&%.compute move|
00000610  6d 65 6e 74 73 20 66 6f  72 20 65 61 63 68 20 70  |ments for each p|
00000620  6f 69 6e 74 0d 02 30 0d  20 e3 63 25 3d 30 b8 6e  |oint..0. .c%=0.n|
00000630  25 0d 02 3a 1c 20 20 76  78 28 63 25 29 3d 76 78  |%..:.  vx(c%)=vx|
00000640  28 63 25 29 2a 61 2b 61  78 28 63 25 29 0d 02 44  |(c%)*a+ax(c%)..D|
00000650  42 20 20 76 79 28 63 25  29 3d 28 76 79 28 63 25  |B  vy(c%)=(vy(c%|
00000660  29 2d 61 79 28 63 25 29  29 2a 61 2b 32 2a 61 79  |)-ay(c%))*a+2*ay|
00000670  28 63 25 29 20 3a f4 6e  6f 20 61 62 73 6f 72 70  |(c%) :.no absorp|
00000680  74 69 6f 6e 20 6f 66 20  67 72 61 76 69 74 79 0d  |tion of gravity.|
00000690  02 4e 13 20 20 78 28 63  25 29 2b 3d 76 78 28 63  |.N.  x(c%)+=vx(c|
000006a0  25 29 0d 02 58 13 20 20  79 28 63 25 29 2b 3d 76  |%)..X.  y(c%)+=v|
000006b0  79 28 63 25 29 0d 02 62  29 20 20 e7 78 28 63 25  |y(c%)..b)  .x(c%|
000006c0  29 3c 2d 77 25 8c 78 28  63 25 29 3d 2d 77 25 3a  |)<-w%.x(c%)=-w%:|
000006d0  76 78 28 63 25 29 3d 2d  76 78 28 63 25 29 0d 02  |vx(c%)=-vx(c%)..|
000006e0  6c 27 20 20 e7 78 28 63  25 29 3e 77 25 8c 78 28  |l'  .x(c%)>w%.x(|
000006f0  63 25 29 3d 77 25 3a 76  78 28 63 25 29 3d 2d 76  |c%)=w%:vx(c%)=-v|
00000700  78 28 63 25 29 0d 02 76  29 20 20 e7 79 28 63 25  |x(c%)..v)  .y(c%|
00000710  29 3c 2d 77 25 8c 79 28  63 25 29 3d 2d 77 25 3a  |)<-w%.y(c%)=-w%:|
00000720  76 79 28 63 25 29 3d 2d  76 79 28 63 25 29 0d 02  |vy(c%)=-vy(c%)..|
00000730  80 27 20 20 e7 79 28 63  25 29 3e 77 25 8c 79 28  |.'  .y(c%)>w%.y(|
00000740  63 25 29 3d 77 25 3a 76  79 28 63 25 29 3d 2d 76  |c%)=w%:vy(c%)=-v|
00000750  79 28 63 25 29 0d 02 8a  06 20 ed 0d 02 94 06 fd  |y(c%).... ......|
00000760  a3 0d 02 9e 04 0d 02 a8  41 f4 54 68 69 73 20 66  |........A.This f|
00000770  75 6e 63 74 69 6f 6e 20  72 65 74 75 72 6e 73 20  |unction returns |
00000780  74 68 65 20 73 75 72 66  61 63 65 20 75 6e 64 65  |the surface unde|
00000790  72 20 74 68 65 20 70 6f  6c 79 67 6f 6e 61 6c 20  |r the polygonal |
000007a0  63 75 72 76 65 2e 0d 02  b2 0d dd a4 73 75 72 66  |curve.......surf|
000007b0  61 63 65 0d 02 bc 0c ea  73 2c 63 25 2c 64 25 0d  |ace.....s,c%,d%.|
000007c0  02 c6 24 20 73 3d 30 2e  35 2a 28 79 28 6e 25 29  |..$ s=0.5*(y(n%)|
000007d0  2b 79 28 30 29 29 2a 28  78 28 6e 25 29 2d 78 28  |+y(0))*(x(n%)-x(|
000007e0  30 29 29 0d 02 d0 0d 20  e3 64 25 3d 31 b8 6e 25  |0)).... .d%=1.n%|
000007f0  0d 02 da 0d 20 20 63 25  3d 64 25 2d 31 0d 02 e4  |....  c%=d%-1...|
00000800  28 20 20 73 2b 3d 30 2e  35 2a 28 79 28 63 25 29  |(  s+=0.5*(y(c%)|
00000810  2b 79 28 64 25 29 29 2a  28 78 28 63 25 29 2d 78  |+y(d%))*(x(c%)-x|
00000820  28 64 25 29 29 0d 02 ee  06 20 ed 0d 02 f8 06 3d  |(d%)).... .....=|
00000830  73 0d ff                                          |s..|
00000833