algorithmic modeling for Rhino
I have a planar grid of points, with points 1 unit apart in the x and y.
I'd like to construct a list of the neighbors of every point - depending on its position, a point should have 2, 3, or 4 neighbors of distance 1.
Using the Closest Points component, it's trivial to get two lists - a list of N neighbors for each point, and the corresponding distances.
I'd like to filter the first list using the second - so that only nodes with a distance of 1.0 remain, while all other nodes are removed.
What is the best way to do this?
Tags:
Good opportunity to study what connectivity trees are (I could replace all that with a C# ... but used Starling instead in case that you are not familiar with coding).
Thanks a lot Peter - this is exactly what I was looking for!
The definition also required the installation of Sandbox - I'm a little surprised that a simple list-filtering function required the installation of components for mesh and topological analysis.
I in fact asked this question because a code solution (in Python) takes just a single line:
[point for (point, score) in zip(l1, l2) if score == 1]
Python? so you are familiar with coding.
Get this (a "bit" more compact, he he) and forget Sandbox (for this case, anyway).
Indeed this is a very simple case ... but I've used Sandbox as an indication for more complex cases.
Anyway you can create connectivity data using solely code (notify if you want, for instance, an example of inquiring a mesh with every imaginable way).
Here's the "GH Way", without code:
If you re-connect the group of wires from the green "Pt" to the "Branch" component, you can use the 'B' slider to see the neighbors for each point, with a diamond pattern of lines through them.
Note that I used 'Dispatch' instead of 'Cull Index' - sometimes it just works better for me.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by