algorithmic modeling for Rhino
Hi everyone, I'd need your help for a combination issue that I would solve inside grasshopper (if possible). Maybe there's a plugin that makes this task easier...or maybe not.
*short version*
starting from a list of 12 items I would find all the combinations taking just 4 at time.
I'd use a Stream gate that takes the indexes of the items and pass them to a list item in order to select just the items of the combination. Doing so I can choose a single combination of index at time to pass to the list item.
In this moment all the data come out from the first gate, all the others are empty.
If I pass these index to the list item it gives me an error (probably because of the data structure).
*long version*
I start from a list of 12 segments, all of them with the starting point in common and the ending point distributed regularly in the space. It's a quite simple starting point.
What I'm trying to achieve is to find all the possible spatial configurations made of 2, 3, 4 segments. I started with 2 segments so I've 12^2=144 possible configurations but just 4 different configurations that can intuitivelly be recognized (60°, 90°, 120°, 180°).
Doing the same with 3 segments generates 12^3=1728 configurations and I don't know how many different ones. With 4 segments I've got 12^4=20736 possible configurations.
As you can imagine many configurations are identical but just with a different orientation so at the end I'll have to parse geometrically the output to delete duplicates (I'll address this later on).
Please could you help me to figure out how to mix these segments in different configurations?
Thank you in advance.
Tags:
The purple group eliminates the combinations where the same item is used twice.
On second thought... There must still be many duplicate combinations where the same four items are in a different sequence? I guess you did mention that.
Thank you so much Joseph! It works fine for me; I'm looking at the definition trying to understand what you've done but the most important parts are outhof reach for me at the moment :P
I would learn something from this like the use of Set or Entwin and Flip or the part inside the cluster...but it would take very long.
Yes there is a bit of redundancy but that's not an issue: among the various configurations most of them are identical, just with a different orientation. Because I'll need to filter them the redundancy given by a different order of the segments will be solved than.
Once again, Thank you!
I added the yellow group to earlier code (segmentscombination_2017Sep23d.gh) using 'Avr (Average)' of the end points as a "unique ID"- but is it really unique? 'MIndex (Set Member Index Example)' is used to trim the tree of "duplicate" combinations, using only the first one that "entered" the 'CSet'. Only 133 unique combinations?!?
Using the mid-points of the four curves in each combination yields the same results, which isn't surprising, but it begs the question: what if each of the twelve base curves are a different length?
Easy to find out... 495 unique combinations instead of only 133!
Haven't tried to figure out why, or what the correct answer really is...?
The numbers from the model appear to be correct, according to this:
Combinations and Permutations Calculator
http://stattrek.com/online-calculator/combinations-permutations.aspx
From the model itself, I had stumbled on the fact that each of the 495 "unique ID" points represents 24 (4 Factorial) different sequences of the four lines in each combination. And 24 X 495 = 11,880.
Showing that was easy for two of the 495 "unique IDs": 0 and 494, but refinements are needed to see it better on the others.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by