aUCBLogo Demos and Tests / linetest
to linetest
cs ht setScreenColor 0
; norefresh
setUpdateGraph false
n=int 200*2200/mips
x=Array n
ox=Array n
v=Array n
c=Array n
repeat n
[ x.repcount=List 400*(rnd-0.5) 400*(rnd-0.5)
v.repcount=List 5*(rnd-0.5) 5*(rnd-0.5)
c.repcount=hsb 360*repcount/n 1 1
]
ox=x+0 ; to create the same structure as in x, so that we can use xcopy and x+=v
i=0
spur=false
pr [SPACE toggles cleaning]
t=0
forever
[; t0=timefine
if key?
[ ch=readchar
if ch==char 27 [stop]
if ch=="\ [spur=not spur]
]
xcopy "ox x ; copy only the values (no new nodes are made)
x+=v ; dito
repeat n
[ if (maxnorm x.repcount) > 298
[ if (abs first x.repcount) > 298
[ _setFirst v.repcount -first v.repcount
]
if (abs first bf x.repcount) > 298
[ _setFirst bf v.repcount -last v.repcount
]
]
]
if not spur [clean]
line x c
updateGraph
gc
; t = (i*t + timefine-t0)/(i+1)
; ct (pr 1/t "frames/sec)
; i+=1
]
end