Some code for the volume wrangle. Volume goes in input 1. Seed points in input 2. And then you need to construct the control interface.
`//controls int mirror = chi(“mirror”); int distanceMetric = chi(“distanceMetric”);
//init variables float currentdist = 1000000; //pick a super high starting value. In theory, it should be infinite… int closestpt = 0; //placeholder for seed point float dist = 0; //placeholder for distance to seed vector pos = v@P; //current voxel position
//mirror if(mirror == 1) pos.x = abs(pos.x); if(mirror == 2) pos.y = abs(pos.y); if(mirror == 3) pos.z = abs(pos.z);
//calculate distances int pts = npoints(1); for(int pt = 0; pt < pts; pt++){ vector ptpos = point(1, "P", pt); vector vdist = abs(pos - ptpos); //vector distances if(distanceMetric == 0) dist = length(vdist); //euclidian/voronoi distance if(distanceMetric == 1) dist = sum(vdist); //manhattan distance if(distanceMetric == 2) dist = max(vdist); //chebyshev distance
if(dist <= currentdist){ closestpt = pt; currentdist = dist; } }`
Above code will give you a density field that stores the seed values. From there, you can parse it how you need.
(gemming my own code for posterity)