Jump to content

nearest point neighbor vex sop, can it be done ?


redpaw

Recommended Posts

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...