generative modeling for Rhino
Hello everyone , I have been trying to sort this out for quite a long time ( since I am a beginner .. and only know the really basic stuff..)
The problem is that I have many points on a surface that I want to group in pairs , but in a way that the selection of the points in each pair happens in a random way , and with the restriction that the distance of the points that belong to the same pair is not bigger than the one I give. If anyone has an idea how this can happen please HELP, because I have tried so many things but haven't been able to come to a result.
And also, it would help me a lot if I could define the number of random points in each group ( lets say instead of making pairs, if I could make triads of points ) with the same restrictions mentioned above !
beers on me, for the people who help me out !!! thnx
I tried to get my head around this but got stuck on the part where you need to ensure that each point is used only once.
While this is pretty easy for an iterative script, it seems pretty much impossible to do with native GH logic. (at least without a complex definition)
I agree with Hannes that you're pretty much going to have to script this. You're introducing feedback loops that are dependent on distance restriction and points only being used once. If you eliminate either of those constraints, it's pretty easy to do. But with them, you need to iteratively exclude points, and to do that, you'll want to run a loop.
That said, even with a script, you're going to have to trick it into getting it so that every single point is assigned into a group. When your loop gets to the end, for example, and all but two (or three or four or whatever) points have been assigned, there's a good chance that the leftovers will fail the maximum distance constraint...in which case, you'll either have to live with a few points not having partners, or you'll have to optimize it so that your points swap assignments. This gets complex, too.
You could probably adapt this.
That wont solve the problem with leftovers though.
Hello again , leftovers are not a problem , since there is no need for a fixed number of points , thus if some of them are excluded from the grouping, it doesn't really matter . I didn't understand your suggestion though .. your link contains something more than the pictures? i guess i cant see it . if you have the patience to explain a bit , I would really appreciate it ... thnx in advance
Look in the comments below the image.
This definition was done to connect any number of points, with a specified max number of connections and connecting the closest points first.
thank you sooo much !
hey , I am going to bother you again , sorry for that.. My grasshopper is more recent than the edition you have used to build your suggestion , and when i try to open it with my grasshopper, some definitions disappear and some connections fail .. is there any chance that you can printscreen it for me so that i can fix mine?
I think you just need Hoopsnake installed.
But i am pretty sure that I have installed hoopsnake
I am uploading a printscreen , to explain the problem .. if you have a couple of minutes please take a look .. thnx
Ahh I see, the component missing is RemoveDuplicatePoints, from Kangaroo.
It is not really needed, just plug the output of Point XYZ to the input of Point.
Set the Slider to 1 to get a list of lines, your pairs are simply then end points of these lines. To get triads etc, the def needs to be modified to draw polylines. I think its the simplest way.
In this screenshot you can see the leftovers effect:
you are awsome ! thnx
have a good night