Skip to content

Instantly share code, notes, and snippets.

@morphingdesign
Created January 26, 2021 03:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morphingdesign/8e87ce6a5518296e22d3383e2247567c to your computer and use it in GitHub Desktop.
Save morphingdesign/8e87ce6a5518296e22d3383e2247567c to your computer and use it in GitHub Desktop.
Connect near points with polyline in Houdini Vex with user-defined radius and max point count.
// Set Wrangle to 'Run Over Points'.
// Collect closest pts for each pt, based on radius and max pts.
// Includes user-managed channels for radius and max pts.
// Note that this list will include the current point being run
// through this point wrangle.
int pts[] = pcfind(0,"P",@P,chf('search_radius'),chi('max_points'));
// Used to visualize list in geo spreadsheet; for debugging.
i[]@pts = pts;
// Iterate through each collected pt.
foreach(int pt;pts){
// Process only those pts in list that are not the current pt.
if (pt != @ptnum) {
// Connect each pt in list to the current pt with a polyline.
addprim(0,"polyline",@ptnum,pt);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment