Biohazard9012 Posted July 18, 2016 Share Posted July 18, 2016 Hi Everyone, I made some good progress with my scene, and everything was working perfectly in my test scene, but now that I've started moving everything over to an actual scene I'm having problems. Basically i have a group of points "group 1" and for each point in the group i want to find the closest point in a different group of points "group 2". I then create an attribute for it called "nearPT" and use the Add SOP to create a line by attribute through nearPT. However the number of points will vary randomly between each group so sometimes it works right and sometimes it does not. I've attached a few pictures to help explain what I mean. I really only want there to be only one "pair" for each of them, as in 1 line going from 1 green to 1 red (the colors are for testing/visualization purposes, but won't be in the final version). It's frustrating because in Image 1, there's only 1 pair, with 2 extra green points. In Image 2, they all match up correctly. In Image 3, it starts screwing up because one of the pairs has an extra line going to a second red point, and finally in Image 4 it's completely messed up with only 1 green and 3 reds, yet they're all connecting with 1 long line. I've been doing most of the work while alternating between a wrangle node and a VOP, however essentially performing the same action by using the NearPoint function. So my wrangle node would be "i@nearPT = nearpoint("op:path_to_merged_points", "group 2", @P, 10). I hope I was clear enough in my description. Thanks! Quote Link to comment Share on other sites More sharing options...
dchow1992 Posted July 18, 2016 Share Posted July 18, 2016 (edited) I think you need to run it in a for loop since if everything runs in parallel points will not be aware of simultaneous connections being made. I'm not sure if I got the behavior right from your description, but I think most variations of it can be achieved like this pair_logic_001.hipnc Edited July 18, 2016 by dchow1992 Quote Link to comment Share on other sites More sharing options...
Biohazard9012 Posted July 18, 2016 Author Share Posted July 18, 2016 7 hours ago, dchow1992 said: I think you need to run it in a for loop since if everything runs in parallel points will not be aware of simultaneous connections being made. I'm not sure if I got the behavior right from your description, but I think most variations of it can be achieved like this pair_logic_001.hipnc Thanks for the reply, i went ahead and looked over your example file. I'm not sure if it seems to be working right, as it doesn't actually appear to be grabbing the closest points to each other (see attached image, where blue is a connection and yellow is what probably should be the closest correct connection). I've gone ahead and attached a quick example file to show what my setup is like, with the wrangle node as well. As I said, the number of points in each group is always changing because they're coming out of separate POPnets. I've tried a few different versions of trying to use ForEach loops and vops as well, but just couldn't seem to get the logic down correctly connectingPoints_Ex.hipnc Quote Link to comment Share on other sites More sharing options...
dchow1992 Posted July 18, 2016 Share Posted July 18, 2016 should red points be able to connect to multiple green points? in that case, you can use the green points to lookup their nearest red point instead and not remove any points from the group after each iteration. Quote Link to comment Share on other sites More sharing options...
Biohazard9012 Posted July 18, 2016 Author Share Posted July 18, 2016 (edited) Preferably not, I'd rather it only be one red to one green point, even if there's say 1 red point and 3 green points. In that scenario I'd rather they just not get used at all, or deleted, whichever is easiest. Edited July 18, 2016 by Biohazard9012 Quote Link to comment Share on other sites More sharing options...
dchow1992 Posted July 18, 2016 Share Posted July 18, 2016 then isn't that behavior above correct? the red point isn't reaching to that green point because it has already been paired Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.