Calculate hair point distance to other hairs (VEX)

This script calculates distance from iterated point to the closest hair primitive on the same stream.

First point wrangle:

s@name = itoa(@primnum);
setdetailattrib(0,"at","@");

Second point wrangle:

string at = detail(0,"at");
string grp = at + "name!=" + s@name;

int npt = nearpoint(0,grp,v@P);
vector nearP = point(0,"P",npt);
float dist = distance(v@P,nearP);

f@dist = dist;
Previous
Previous

Hair Interpolation in Houdini with VEX

Next
Next

Transfer skin point attributes to hair primitives with VEX