Forum

How to intelligently distribute X objects in Y points

Hi, i have a spread of 12 objects that i want to “intelligently” distribute over a number of variable inputs (1 to 4).
By intelligently i mean that for example if the 12 objects are all distributed along 2 inputs (lets call them input A and input B, having 6 objects each), when another input is “activated” (lets say input C), 3 objects from input A and 3 objects from input B will have to move to input C.
As for now i can obviously evenly distribute the objects along all the inputs, but when the input count changes all the objects move and mix between all the inputs…

I have attached a sample patch with the current (wrong) behavior, i think i am missing a basic concept to get this to work properly.

Do you have any hint to point me in the right direction?

I am looking for a solution that can work with a variable number of inputs and objects, but solving the basic attached patch will be a good starting point.
Thanks!

object distribution.v4p (17.0 kB)

You should describe better/post the behavior you expect.
For example I was able to predict where each quad/number would go after clicking on IOBoxes at a first glance, meaning that, to me, it’s an ordered, err, order.
The only thing I would add it’s a link between object count IOBox and rightmost LinearSpread Spread Count.
InputMorph it’s useless the way you use it right now.
I like this kind of problems, so I attach a quick “review” of yours. I’d like to understand better what you would like to achieve, though.

object distribution_mod.v4p (16.8 kB)

h99 thanks for your quick reply, i think you misunderstood what i was looking for.

Below is a visual representation of the actual behavior: when the active inputs change (eg. from 2 to 3) all the elements mix together in a “messy” way (objects move from A to C, from B to A, from A to B…) and they finally arrive in A, B and C.

What i would like to achieve is a distribution along A,B,C (the object order in these 3 inputs does not matter) with a “clean” transition where, taking the below graphic as an example, there will only be objects moving from A to C and from B to C (so without any mixing between A and B).
This will make the transition look much better. Hope this example makes the problem clear, thanks again and hope you come up with other suggestions!

Is the actual behavior what you want? Or like it is now?

Well, isn’t the only trouble you seem to have is the logic for the Inputmorph, that generates your messy, random way? (like attached patch)

Or do you want something that will only move the elements that needs to be moved, and leaving the rest in place?

object distribution 3.v4p (19.8 kB)

I have try without lucky…
it’s so tricky for my skills…Nobody have a clean solution?

Hey crash

If you are looking for a 1-2-or-3 kind of distribution, maybe Track helps.

If you are looking for something different, try to describe it better. Don’t be shy to use paint ;)

Thanks guys for your support.
Below is another image to better explain the “problem” : what happens is that when the toggle in the image is triggered all the object mix between them before going to their positions in input A/B/C.

Considering the image, this means that for example object nr 10 goes from A to B, 0 goes from B to A… instead i would like only objects moving from A and B towards C without any mixing between the previous inputs (A and B). So the only correct objects moving, in the below example, are 11, 8, 5, 2 that are moving from A or B towards C.

I think that avoiding mixtures between A and B will make the transition cleaner and nicer.
Hope this makes the whole thing easier to understand, and hopefully to solve :)
I had already checked Track but with no success.

After some messing around i arrived to a sort of solution. Probably not the smartest/cleanest way, but it worked for me.

Using a framedelay each activation will allocate a random number of objects to the new activated input so there will be no mixing between previously existing positions.
Deactivating an input will re-set the slices that were in that previously activated position randomly in the other still active positions/inputs.

Hope this will help/inspire somebody else, thank you all for your support!

object distribution - framedelay.v4p (43.1 kB)