Grasshopper

algorithmic modeling for Rhino

hello people!

i have this tree:





if this is {A;B}(i)  i would like to get {A} (B as branch number)

so the list would look something like this:

{0;0}  24
{0;1}  25
{0;2} 165
etc..
{1:0} 32
{1:1} 33
{1:2} 160
etc..


thanks for reading!

Views: 345

Replies to This Discussion

Head scratcher... I don't think that the path mapper is going to be able to do this all for you all it one shot. Although what your asking makes a sense, there just isn't really a way to map this. The best thing that could be done would be to use a combination of several steps in order to reconstruct the tree how you want it.

First off, you would need to reduce your data down then "base branches" that you want. So what was {a;b} is now just {a}. The result is that all of the data that was in all those sub branches is now all under that main branch. So instead of just having 2 in each sub branch you'll have 2*(no. of branches) in your main branch.

From here on out, we're actually going to use the SubList component to reassemble the sub branches in a more ordered fashion. So after reducing the data, find out the number of items in each branch (list length) and then create an interval from 0 to the number of items. Now you need to divide that interval in a way where the number of divisions allow for the proper number of items that you're looking for. I did this by simply dividing the list lengths by the number of items I wanted, then feeding that into the Divide Interval component.

Then only thing about the divide interval component is that the way it divides is not necessarily conducive to extracting chunks because the "ends" of the divided intervals will tend to overlap. IOW, if I have an interval from 0 to 8, then divide it into 4 pieces (2 items for each sub interval), I'll end up with intervals of 0-2, 2-4, 4-6, and 6-8. Its not that this is wrong, but if I'm extracting indices, then 2, 4, and 6 get "doubled" by being at the end of one interval and the beginning of another. Therefore after you divide the interval, you then need to ressemble the interval so that the end of the interval is one integer lower, so 0-1, 2-3, 4-5, and 6-7 in the previous example.

After that just plug those adjusted intervals into the Sub List component and you'll essentially have the result your looking for. In my case, I then had to clean things back up with the path mapper because the result was {a;0;b} when you're really looking for {a;b}

The only glitch in this approach is that the number of items in each sub branch is only not even (branch {1;160} has only 1 item). I guess you could potentially use the list length from the original path structure to match this later on, but I'll have to work a bit more to get that to work.

I attached a file that goes through the process I described above.
Attachments:
WOW! talk about supportive. thanks a lot for the input, "teach" :)

i really appreciate you taking the time to give such a comprehensive response!

i must admit 'though that i didn't understand the solution 100%, and i couldn't make it work the way it was intended to, but i did use part of it and i did manage to achieve my goal going on a different route.

i would like to understand it thoroughly, but unfortunately i don't afford the time and energy, since i have my thesis due in 10 days and i am a mess...

thanks again for the input and i will take another look at it after the thesis (if i'm still mentally sane)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service