point clouds and vex

   1710   0   1
User Avatar
Member
33 posts
Joined: Nov. 2008
Offline
I've got a thread going on over at odforce with some questions about how point clouds work under-the-hood. Was hoping someone from SESI would chime in and give us some info regarding a weird case where they don't work as one (well, I) might expect:

odforce thread [forums.odforce.net]

Original post:

Can someone fill me in on why the scheme in the attached file doesn't work? Basically, I'm using a wrangle to do some point cloud searching. I want to switch the searched geometry based on some attribute on the wrangle's input geo. The vex for that looks like this:
float radius = ch(“radius”);
int npts = chi(“numpts”);

int handle;
if (@side > 0) {
handle = pcopen(@OpInput2,“P”,@P,radius,npts);
} else {
handle = pcopen(@OpInput3,“P”,@P,radius,npts);
}

v@Cd = pcimportbyidxv(handle,“Cd”, 0);
i@num = pcnumfound(handle);

pcclose(handle);
I'm guessing that my implementation doesn't play nicely with the way that vex / point clouds parallelize, or something. The result is that half of the points don't find any matched points at all (pcnumfound gives 0).

The attached file demonstrates it visually. The code above (node “pc_broke”) results in half of the points failing to find matches. If I use the same search geo for both groups (node “pc_works”), then all points find matches. And if I do it in two wrangles, each constrained to one group of points and one search geometry, I get the desired result (node “CORRECT”).

Removing the pcclose() has no effect, btw.

Attachments:
pc_vex.hip (92.5 KB)

  • Quick Links