I have 3 different curves on the same plane. I need to move them on z axis. Then I need to select them in a way they dont repeat, they need to be random. On the right I did it by hand. I figured out a way but its repeating at least twice like the second image.
Start by creating a list of your curves. Then create an array of planes in the desired direction. Then orient your curves to the array of planes by creating a list of random indexes, which has a domain equal to the number of curves in your list.
But did you notice the one you did, the square shape repeat twice in a row.
I need them to be sorted randomly but cant repeat. has to be something like this 0,1,2,1,2,0,1,2,1,0ā¦
and not like this. 0,1,1,2,1,1,0,2,1,2,2,0ā¦ (notice there are numbers repeating twiceā¦)
Thanks
Hello
you could apply the 4 color theorem to your problem.
The tool need a Topology that links a slice to the other
Slice 0 is linked to 1
Slice 1 is linked to 0 and 2
ā¦
Then the tool could propose you color (index) that are not the same.
Will give it try on this one, looks very interesting. I used colors just be visual, at the end I wont need the colors. But looks like I can extract the list I am looking for.
I realized I made an error in my original script. The domain for indexes need to have an upper limit of (ListLength - 1). I have adjusted this here.
If you do not want repeating indexes, and since we are working with a one dimension array, you can increase the length of the index set, then delete consecutive indexes in the set. Finally split the list to obtain the correct amount of indexes from the lengthened list.
The advantage to this approach is it will always be truly ārandomā (pseudo-random anyway), and the randomization can be adjusted by changing the seed.
Iām not exactly sure how the plug-in @laurent_delrieu suggested works, but it appears to be more algorithmic than random (meaning you will always get the same order of indexes).
This uses Jitter for randomness but itās very difficult to find a āSeedā that never repeats. Maybe an Anemone loop would work? Or maybe the premise is misguided?
Hello @baileydw
you are right this simple approach doesnāt need plugin. The ān colorā method has the advantage to be be more generic has it uses topology.
The tool I made also use the same random (.NET random) and there is 2 modes, one that limit the number of colors (2 here) or another like your approach (the one I propose).
It is funny that you could see
on so little numbers. Probability could be tricky ! I tested the 2 tools with 1000 and 10000 elements and I get this count for 0, 1 and 2.
Your result is on the left.
Yes and no as the tool is freely available on the link I provide.
And you wanted to use Anemone, so you can keep your useless comment to yourself. Anemone is a plugin. And please help us to find the flaw in @baileydw script that could explain why there are not an equal number of items
@laurent_delrieu while I appreciate the attention to detail regarding the ānot equal number of itemsā, this constraint was not originally proposed by OP, so I had not included it in the script. Good call on the random integer option, I had forgot about that! No need to roundā¦ Finally, I only assumed the solution you posted was algorithmic and not random because there is no seed slider, but there appears is an āSā input on the component you showed, which I assume is the seed input? I just cant be bothered to install another plug-in when itās not needed.
@Joseph_Oster why use Jitter when the script I uploaded already solves the issue of culling repeating consecutive indexes? No need to āfit a square peg into a round holeā so to speak.
Yes you are totally right, no need of plugin for this but it is useful to know the ān colorā theorem that could be useful in many architecture problems (panels ā¦).
Also I think I understood why there are more 1 than 0 and 2, as you use round
it is better to set an interval like [-0.4999 to 2.4999] in order to have an equal number of 0,1 and 2
Ouch! Yes, Anemone is a plugin I use from time to time.
I missed that detail, will look again.
Here is a solution that uses Anemone, with colors not limited to 3, but as I type this, I realize the color count should match the number of curves. Oh, well Iām outta here, donāt like to hang where Iām not wanted.
Except for one showing ā0 to 300ā (seed range), these text panels can be ignored.
It is new to me too! Unfortunately it has some serious limitationsā¦
I wish it output the values of the culled items, instead of just the countā¦ This would be highly useful when trying to replace the removed items to the end of the list as, I am attempting to do here.
Maybe you can help me determine how to re-insert the removed consecutive items to the end of the list?