Last active
February 6, 2024 22:37
get distance to points wrangle #houdini #vex #wrangle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you