I am referring to interlacing as in older interlaced video techniques where the lines of pixels on your screen would be rendered in an alternating pattern of every second or every third row. (https://en.wikipedia.org/wiki/Interlaced_video has a good gif of the process)
so if you have your rows(1,2,3,4,.....99)
they would be rendered (factor 2) in the order rows(1,3,5,7......97,99,2,4,6,.....98)
or (factor 3) as rows(1,4,7.....2,5,8.....3,6,9....)
I'm trying to write a script that will reorder a sequence of arbitrary length according to this pattern with JSL but I can't quite figure out how to build an index to reorder this. I'm currently trying to work out matrix math to accomplish this but maybe a for loop would be smarter/easier?
// Create arbitrary sequence
a = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,21,22,23,24,25,26,27,28];
f = 3 // interlacing factor
//Start trying to work out an index or grouping for a future sorting op
b = mod(a+f-1),3);
//b = [0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 0, 1, 2, 0, 1, 2, 0]
// ????