this is what i have so far, based off this code (https://www.sidefx.com/docs/houdini/vex/functions/argsort.html) but a type error occurs at line 5 “push ()” - I dont understand why this error is coming from as the types seem right to me. this breaks the rest of the code due to null array pd
int points[]=pcfind(0,"P",@P,chf("fuse_dist"),10); float pd[] = {}; foreach(int j; points){ push(pd, point(0, "density", j)); } int ordering[] = argsort(pd); int points_by_dens[] = reorder(points, ordering); print_once(sprintf("%d, %d, %d, %d\n",len(points), len(pd), len(ordering), len(points_by_dens))); int fused = pop(points_by_dens,0); float d = point(0,"density", fused); //vector c = point(0,"Cd", fused); foreach(int i; points_by_dens){ d += point(0, "density", i); //c = max(point(0, "density", i),c); removepoint(0,i); } setpointattrib(0,"density",fused, d); //setpointattrib(0,"Cd",fused, c);
if i put a random float in instead of the point() at line 5 it works better (code still doesnt function as planned if anyone else has tips on how to achieve what i want!)
any help is much appreciated as I am new to houdini!
Thanks



