Daniel Posted June 24, 2020 Share Posted June 24, 2020 I'd like to get a list of all connected points to my current point and the vex command "neighbors" does that. But I'd also like the option to grow this selection to grab the next ring of points.. the same as what the "Group Expand" node does when you increase "steps". The group expand is too slow as I need to do this for every point on my geometry. I'm about to embark on a nested loop using the "neighbors" command but it's a bit mind bending and curious if anyone's done that before so I don't have to! Thanks D Quote Link to comment Share on other sites More sharing options...
animatrix Posted June 24, 2020 Share Posted June 24, 2020 Hi, You can do it like this: function int [ ] getPointNeighbours ( int geo; int ptindex; int depth; int accumulate ) { int pts [ ] = array ( ptindex ); int lastpts [ ] = pts; for ( int i = 0; i < depth; ++i ) { int newpts [ ] = { }; foreach ( int pt; lastpts ) { int connected [ ] = neighbours ( geo, pt ); foreach ( int c; connected ) { if ( find ( pts, c ) < 0 ) { append ( pts, c ); append ( newpts, c ); } } } lastpts = newpts; } if ( accumulate ) return pts; else return lastpts; } int pts [ ] = getPointNeighbours ( 0, 42, chi("depth"), chi("accumulate") ); foreach ( int pt; pts ) setpointgroup ( 0, "pts", pt, 1 ); 4 Quote Link to comment Share on other sites More sharing options...
Daniel Posted June 24, 2020 Author Share Posted June 24, 2020 Amazing! thanks for this. I'll give it a try D Quote Link to comment Share on other sites More sharing options...
Daniel Posted June 24, 2020 Author Share Posted June 24, 2020 BTW this works exactly as I described. Thanks ! 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.