Grasshopper

algorithmic modeling for Rhino

Compare values inside a list - How to form a new list from existing one(and keeping indexes)?

I have a list with N branches (you can see just 2 in the definition below, but it could be 3, 10, ... ), with x number of items in each branch.

How can I form a new list from the existing one - the new list should contain a smallest value of the values with the same index. I should keep order of the indexes. 

For example, item [21] of the 1st branch = 1, item [21] of the 2nd branch = 2, so item  [21] in the resulting list = 1.

Any advise?

Views: 1490

Attachments:

Replies to This Discussion

If your branches don't have subbranches you can do something like this:

 

This worked for me, thnx :)

The idea was to select the shortest line for each index, a final def. is a combination of flip matrix and this http://www.grasshopper3d.com/forum/topics/getting-the-longest-of-3-...

Attachments:

Natalia,

If you use the path mapper to change the list items into the primary branches, you can then sort among the same indexes and sample the smallest item out.  Does this work for your purposes?  You can then either flatten the tree or keep the new branching.

Nathan

I think that should work but i cannot understand how to use it (if i just copy the def. above - it doesnt works). Have you any references or tutorials about Pathmapper and related components? It looks powerful, especially for more complex cases

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service