Multi dimensional slice selection

I’ve created a small test patch, trying to create a 2 dimensional spread of sprites, and then select from the resulting array.
One spread controls my x axis of sprites, and another the y axis, but when selecting, I can only select from one axis.

In my test patch I can only select a vertical column of sprites, and never a row. How can I gain greater control over slice selection when dealing with more than one dimension?

I’ve attached the test patch in case it helps illustrate the issue.

2DSpeadTest.v4p (8.4 kB)

meet mr. i

2DSpeadTest.v4p (15.3 kB)

hi benkyma!

there are several ways to that. i sketched 4 of them ;)

  1. in the first patch getslice (node) is used to select the transforms. note that if you use the transform feature of the sprite module, then you shouldn’t also use x and y pins of the module. you would just double the transform in that way. btw imho forgotten spreads in pins are the most convenient way to mess up patches. so take care of stuff like that. so in that patch the sprite module is only spreaded over the slected transforms. to select rows (over y index) you can just use the bin feature of getslice. bin = row in our example. so just set binsize to x resolution. selecting columns is not as easy. you need to calculate the indices for that. inspect the spread on the second getslice and use the index of the green sprite to understand the index ordering…

  2. the second example tries to use the binssize also for column selection. to be able to do that, rows and columns of the incoming spread of transforms need to be swapped. the I (Spread) reconstructs the original indices. SwapDim (Spreads) changes the ordering. with the upper GetSlice (Node) the transforms are resorted. after that you can use the BinSize feature…

  3. tries to do the same but even more index centric. the goal was to put all transforms in one spread, to be able to use only one sprite module. x and y index now only compute the indices within the transform spread. _in fact i’m not sure: there has to be a module for that, not(?) like SelectRow, SelectColumn (?)._Anyway. Only indices are computed and put together into a spread holding all indices which need to be drawn. Only one GetSlice (Node) operates on the transform spread. colors are seleected to get the same visual result as before.

  4. doing it the easy way.

if you want to design ( texturize, colorize …) the original 2d sprite matrix and only want to select afterwards which of them should be drawn the slice centric way is the way to go. otherwise other approaches might be easier and more flexible.

hope you have some fun with it!


oh yeah. #5.

is based on #3 but the indices are used to put a huge color spread together. all sprites are drawn. (8.8 kB)
2DSpeadTest_5.v4p (16.8 kB)

That’s fantastic. Thanks a lot!

I made some subpatches for myself dealing with 2d arrays either. But its a different approach as I had changing bin sizes. May be its a help for someone. (16.2 kB)

I still can’t find a way to select my sprites un-invasively. For example, if I want to draw all of them, then select just some and trigger a reaction on them, I can only seem to do it on the one axis. For example, how would I achieve the effect in the attached patch, but moving the other way…?

envelopeLights.v4p (10.3 kB)

hi benkyma.

yes right, #6 is to stick with your first idea:
compute values, select one and afterwards compare all values with the selected value.

however you need to do that for all sprites. that is you need to do that after the cross operation.

the attached patch compares each sprites x position with a reference x position. after clicking that check box its the y posistion which gets compared. so EACH sprite is the keyword here.

envelopeLights.v4p (10.2 kB)

@frank: cool modules by the way…

however with the newest binsize features of getslice and setslice you can patch more efficient.

multi spreads.v4p (28.5 kB)

I see,thanks. Mine was for 14.9. This fast version progress keeps you learning. Damn, now its too easy to handle bins ;D

@gregsn, you’ve been a massive help. Thanks a lot.