Grasshopper

algorithmic modeling for Rhino

(SOS) How to compare the smallest value out of 3 value sources

Hey Guys,
I have a small problem. I have a situation were i have  3 sources to compare.. i was able to compare 2 of them and dispatch the lines  (smallest).. I am a bit confused in comparing all three together.. can any one tell me how to proceed..
Thank You

Views: 784

Replies to This Discussion

simple but dirty way. if you have 3 lists A, B, and C. get the min of AB, get the min BC, then get the min of those two mins.
...Or you could use data trees in concert with everyone's favorite component [Pull Point] to make your definition dynamic with as many source points as you want!

Attachments:
Nice solution!
Hey Taz, Thanks a lot.. this is what i wanted, but i couldnt understand the pathmapper function.. i mean i wont be able to use it to solve some other problem..
that is a good solution taz.
Tushar, the path mapper just makes sure that all the data paths line up. what happens with paths is that some of the data looks like {0;1;0} and some of the data is {0;1} and so on. what the path mapper does is tell the {0;1;0} path structure to look like {1} by removing the first and third path. so the component maps {A;B;C}(i) to {B}(i) because path B is the only path that has the data we want. it just says to forget about A and C. taz could have used the same logic where he put the simplify node. there the data look like {A;B}(i) and then you would map that to {B}(i). the path mapper is very power full and you should get familiar with it. but really confusion to explain

to see the path type plug the data into path mapper node (it looks like a tree)
thank you robert.. i'll get my hands on it.. and i tried ur method as well.. i am still not able to get it.. i have 3 points.. A, B, C.. i compared A&B and i got 2 Results i.e points closer A and points closer to B.. then i compared B&C.. i got 3 results again i.e points closer to B and closer to C.. now i got 4 results.. can u send me a small example..would be great..
Thank YOu
here is a simplified version of taz's solution

-robert
Attachments:
can someone provide a clearer explanation of taz's defintion particularly around the pull geometry and list item commands.
I guess I could do that...

I'll try to be general (for now) with words and add pics later if necessary. [Param Viewer] is essential to follow what's going on.

From the 5 x 5 grid of points a branch is created for each point (25 paths, N=1 for each) which is feed into [Pull Point] for the pull geometry [G].

Correspondingly for the 4 source points a branch is created for each point and duplicated 25 times (4 paths, N=25 for each). This tree then needs to be inverted with [Path Mapper] so the structure will correspond to the format of the pull geometry. The mapping {A;B;C}(i) > {i}(B) produces (25 paths, N=4 for each) the structure to feed into the search point [P].

The [Pull Point] boolean toggle [C] needs to get set to False to obtain all the distances between all search and pull points (4 x 25 = 100 values).

Simultaneously there is also an index being created to correspond to the list of the 4 source points. This index is the integers 0 to 3 which are branched and inverted similar to the source points (25 paths, N=4 for each).

The distance output [D] from [Pull Point] is then sorted synchronously with the source point index for each branch. From the following screengrab branch {0;0} corresponds to a point in the 5 x 5 grid and the shortest distance between that point and a referenced source point index is 5.261. The index of the referenced source point is 3.


For each following sorted branch the first sorted index value will correspond to the closest source point (first [List Item] shown). This index value is then used to select from the original list of duplicated and inverted points and this is done for each of the 25 branches (second List Item shown).

Draw a line or whatever an away we go!
thanks a lot, it makes perfect sense now.
Thanks a lot guys..
I was looking at the solution from Robert (which is actually more condensed and quicker executing...) but mixing trees and lists always seems a little strange to me.

I can never reliably predict how components will function when mixing data types. Can anyone weigh in on this?

I suppose if a solution works, it works, but still....

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service