Skip to content

Instantly share code, notes, and snippets.

@simonreeves
Last active February 6, 2024 22:37
Show Gist options
  • Save simonreeves/a4396e52cc22755bc687dd39b0b1ed4e to your computer and use it in GitHub Desktop.
Save simonreeves/a4396e52cc22755bc687dd39b0b1ed4e to your computer and use it in GitHub Desktop.
get distance to points wrangle #houdini #vex #wrangle
// get nearest point index of second input
int np = nearpoint(1, @P);
// get that point's position
vector np_pos = point(1, 'P', np);
// measure distance
float dist = distance(@P, np_pos);
// normalise distance
dist = fit(dist, ch('in_min'), ch('in_max'), ch('out_min'), ch('out_max'));
// remap with ramp
dist = chramp('remap', dist);
// set attribute
f@dist = dist;
@alonsoMXR
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment