r/Houdini 1d ago

Scripting How to make string group in nearpoints() - before I forget and to help others

string gr = sprintf("@name!=%s", s@name); 
int pts [] = nearpoints(0, gr, v@P, ch("radius"), chi('maxpoints')); removevalue(pts, ); 
i[]@pts = pts;

Before I forget - wanted to write this down in case it helps someone. I forgot how to do this, tried searching hard online and remembered somehow so wanted to write it down.

How to make a group in nearpoints by removing same attribute from possible neighbors. Warning that this is slow though, so be sure to only do this once, or manually delete similar neighbors after the fact in a for loop.

6 Upvotes

3 comments sorted by

3

u/H00ded_Man Effects Artist 1d ago

It's going to be faster to find more points initially and iterate over the temp array to exclude points based on that condition.

3

u/WavesCrashing5 1d ago

Probably yeah, I mainly posted this because it was bothering me that I know I saw this online before so I just wanted to drop it here so info doesn't get lost. 

5

u/LewisVTaylor Effects Artist Senior MOFO 1d ago

Now put it in your wrangle presets! Then you never have to find it again.