Grasshopper

algorithmic modeling for Rhino

I have a series of points along a set of U-curves on a surface. I need to find the closest point between any given point, and the points of the same index from the other U-curve paths. For example, if there are 41 U-curves, each with 161 points along them, I want to pick a point and be able to search among only the 41 points of the same index value.

I've tried to do a series component going into a list item component, which works when only one index is selected from the 161 available; I thought the same logic would work to be able to run the same operation on all 161 indices at the same time, but it doesn't seem to work quite so simply.

Another way I thought of doing it would be to say I want to pick a point of branch x, index B, and search only the two points next to it, which would be x,B+1 and x,B-1, but I don't know how to perform this logic in grasshopper.

Any suggestions?

Views: 4273

Attachments:

Replies to This Discussion

Can you graft each set of points so that ther would be 41 branches each with 161 items? Then if you plug that grafted list into a list item with an index of 46 (for example) then it would isolate every 47th point along each curve. You could then flatten those points and find the closest points to whatever point you are testing.

that's actually the organization that i already have set up - the PTS component feeding into the list item is already set up such that it has 41 branches with 161 items; the trouble occurs when i try to do a series on the list item 

Unfortunately I'm on my iPad so I can't check out your file but from the looks of the photo I don't see why you need another list item after the first one (let alone a series component).

If you have your point to measure from, and your list of 41 points on the same branch (which you should get from the first list item component) can't you just plug the single point into one input of the CPs component and flatten the 41 points in the other input?

i am able to isolate a single row of points with the same index, using the first list item component; but this works only when that list item is searching for a single index value; the second list item component is used to perform the CPs operation on every point within the row.  the problem is that the first list item component doesn't work when i do the series operation on it - which ideally i need to do because ultimately i want to search for the distance of the closest point of ALL 41*161=6601 points on the surface.

I'm still not sure what you are ultimately getting at.... I thought you wanted to choose a point and get the closest point in the same U row

"I need to find the closest point between any given point, and the points of the same index from the other U-curve paths."


If you want to just pick a point and test all the other points on the surface, why not just flatten ALL the points and test your chosen point against them? 


Unless you are choosing multiple points to measure from? But even so if all you want is the one (ore more) closest points to those chosen points you can just plug in all the points to the CPs component rather than try to select them all with a series and list item.

for each point that i want to test, i only want to test it against the other points in the same horizontal direction (if we're looking at the photo for reference), so in other words NOT the points along the same U-curve; the way the path structure is set up, these points on the same horizontal happen to have the same index value of each U-curve.

so the trouble is that I need to test each point selectively from only the points along the same horizontal/row/V-curve. that's why i used the first list item to filter out only points of the same index value from all branches

Oh I thought you wanted to choose one point and test it against the others - not select all those points in a row and test them against themselves.

In that case I think you still dont need the series or second list item. Cant you just input the list of points in a row to both CPs inputs and graft the first one? (so that each point gets to be tested against all the other points individually)

that makes sense, good point - i don't need the second list item or second series business; so that works when i'm selecting a single row for testing; i still can't figure out, though, how to repeat this operation for all 161 rows...the series component doesn't seem to do it

in this picture, the row highlighted in green all have the same index value, but are on different branches. for each green point, i want to test ONLY the other green points.

I don't know the answer, but I have one thought: The Flip Matrix component would convert your data tree into one where all the points at the same index are in one branch, which should be useful. (So instead of 41 branches with 161 points each, there would be 161 branches with 41 points each). (Note you may have to Clean the tree and remove empty branches before it will "flip".)

true, this will give me a data structure such that each row of points i want to test is contained within a single branch. however, how can i repeat this operation for ALL branches? i can pick a single branch to test using the Tree Branch, and plug in, for example, (0,40) to select the 40th branch; but is it possible to run a loop that tells it to pick the 0, first, second, 3rd, 4th, 5th, etc. branches and run them all at the same time?

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