redpaw Posted March 2, 2010 Share Posted March 2, 2010 trying to create a nearest neighbor vex sop.. I've put together this little snippit of code.. and it compiles.. but doesent return proper Point ID's to the array. I'm just scattering points on a surface and trying to get the closest 1-5 points to each point to use in a copy sop. sop neighborhoodGroup(string fileName = ""; int maxSearchPoints=5; float searchRadius = 1;) { float n[] = {0.0}; resize (n,maxSearchPoints); int handle = pcopen(fileName, "P", P, searchRadius, maxSearchPoints); int i = 0; while (pciterate(handle)) { int pointID = -1; pcimport(handle, "PT", pointID); n[i] = (float)pointID; i++; } addattribute("nearest", n, maxSearchPoints); } I'm passing the string op:`opinputpath(".",0) to the fileName parameter, which works in another file / thread I found on odforce. Not sure if its possible to ge the point number from the pcimport command? is there any (other) way to do this? I tried getneighbor but that relies on connectivity and I don't have connected points. its just a cloud. thanks in advance redpaw Quote Link to comment Share on other sites More sharing options...
redpaw Posted March 2, 2010 Author Share Posted March 2, 2010 figured it out.. pcimport(handle, "point.number", pointID); does exactly what I need. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.