I'd like to try and write the nearpoint vex function in a way that lets me grab the ID of the nearest point to the current point on the same geometry, if I write
int npt = nearpoint( 0 , @P, chf("maxDist"));
this fetches the current point index, since it is the ID at @P location. but I'd like to ommit the current point index, I want the nearest point to it instead.
One workaround I've used so far is to use the nearpoints function instead and set the max search points to 2, get the second index, since I know the first index is the one at @P. like this:
int npts[] = nearpoints( 0 , @P, chf("maxDist") , 2); int nearpointID = npts[1];
I saw in the documentation that you can also specify a group of points to consider for the search, and that it accepts a "SOP-style group pattern such as 0-10 or @Cd.x>0.5."
so I tried this code to try and ignore the current ptnum:
int npt = nearpoint( 0 , "!@ptnum", @P, chf("maxDist"));

