Archive: Cyclic Array


10th April 2004 12:27 UTC

Cyclic Array
A little experiment with a cyclic array.


10th April 2004 13:23 UTC

There is black window, without any motion & color.


10th April 2004 14:15 UTC

You'll need Avs 2.81b


10th April 2004 15:53 UTC

you could optimize the whole thing a lot by using a cyclic buffer. that is, if you had 5 buffer entries you now do this

copy 3 to 4
copy 2 to 3
copy 1 to 2
copy 0 to 1
put new data into 0
use 0, 1, 2, 3, 4


using a cyclic buffer means you do the following:
bufnum=5

bufbase=(bufbase+1)%bufnum
use (bufbase+0)%bufnum, (bufbase+1)%bufnum, (bufbase+2)%bufnum, (bufbase+3)%bufnum, (bufbase+4)%bufnum

understood? :)
you save the copying time and shift the base index by +1 (the % is the modulo operation, which does a division and returns the rest


15th April 2004 15:25 UTC

you could optimize the whole thing a lot by using a cyclic buffer. that is, if you had 5 buffer entries you now do this
Uhm, i used a cyclic buffer...

Just look at the (simplified) code;

per frame:
ww=80; points per ring
hh=100; amount of rings
fc=(fc+1)%hh; offset, your bufbase
loop(ww,exec2(assign( gmegabuf(cc+ww*fc),
(getosc((cc/ww),.1,0))) ,assign(cc,cc+1))); assign
getosc data for each point on the ring.

per point:
z1=gmegabuf((pc+fc*ww+ww)%n); retreive array data and
counter the offset.
pc=pc+1; pointcounter

15th April 2004 16:10 UTC

oops i must have overread that, sorry :)


16th April 2004 22:43 UTC

/me demands interactive 3d rotation "drag'n'drop" style :P
nice curves! :)