Grasshopper

algorithmic modeling for Rhino

Perform operations on values of one Tree based on the values' pattern of another.

Hi All,

I have 2 trees that have the same structure and I want to manipulate the values of one tree as per the values or pattern of another one. In the image attached, I want to average the values in the first  tree that are paired with the same value in tree 2, and keep the tree structure in terms of branches  intact.

ex: in branch{0:291;2}, the values @ indices 0 and 1(115.xx,116.xx) in tree 1 have the same value of 0  at tree 2, so these should be averaged. While the value @ index 2 is solo and thus is going to remain the same.

I hope that the question is clear.

Views: 599

Replies are closed for this discussion.

Replies to This Discussion

Do you have an example GH file?

If its only 0 and 1 then you can use this as a Boolean pattern for Dispatch and then pass each resulting output through an Average component before Merging them back together. If its more i.e. 0,1,2 and 3 then Sift Pattern instead of Dispatch

* I should have generated random seeds so that the answers aren't all the same but hey ho

Thanks Dany. I managed to do it with a ghpython component. Both x and y are set to 'list access'. Not the best way to use dictionaries but it does the job.

2 things:

1) you should verify your answers because I don't think they are correct.

2) it is slower than the GH method I showed above. (but as it is only 2% of your total processor time it probably doesn't matter)

do you ever have more than 2 of a similar ray? if so then your method gets the average of the first two rays and then the average of that average and the next ray.

If not it won't matter.

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