VEX: 'reset' a pciterate loop

   5502   6   1
User Avatar
Member
10 posts
Joined: Sept. 2008
Offline
Greetings,

I am using an algorithm to process points from a point cloud that requires me to iterate over all the points twice (unfortunately). So, this begs the question: What is the proper way of resetting or restarting a pciterate loop? Do I have to close the handle (pcclose), and reopen the point again or is there some other way to simply loop again without having to pcclose/pcopen again? (To call the pcopen twice seems…unnecessary.)

Regards,
Van Aarde.
User Avatar
Member
4271 posts
Joined: July 2005
Offline
There isn't any reason why you can't call pcopen more than one time. The AXYZ SSS shaders in the Houdini distribution do this.
if(coffees<2,round(float),float)
User Avatar
Member
10 posts
Joined: Sept. 2008
Offline
Hi Wolfwood,

Thanks for the reply .

I wasn't saying (or thinking) that theres anything wrong with doing it that way. I was merely trying to find it if there is a more *optimal* way of doing it.
Now, I not familiar with the internal workings of the point cloud functions so this is how I picture it would work:

pcopen() looks up a bunch of points within the specified radius from a given point. These points are stored in memory (??) and an pciterate can be used to iterate over them. Now, to iterate over them a second time, I would have to close the handle, pcopen() again (which does the whole lookup thing again), stores the points in memory and only then I iterate over them again.

All I want to do is iterate over the points without having to do the pcopen lookup again: something like:
pcreset(handle); <– reset the iterator to the beginning of the list.

Unless, of course, if the pcopen/pciterate functions are so super optimal that it is not necessary at all…then I'm okay with it .
User Avatar
Member
4271 posts
Joined: July 2005
Offline
Hmmmm. Despite what the help says I seem to be able have multiple pciterates without any ill effects.
if(coffees<2,round(float),float)
User Avatar
Member
665 posts
Joined: July 2005
Offline
I have had mixed results with multiple loops at the same time. I guess it really just depends what you're looking to get out of the loop.


-j
User Avatar
Member
941 posts
Joined: July 2005
Offline
nanocell
pcopen() looks up a bunch of points within the specified radius from a given point. These points are stored in memory (??) and an pciterate can be used to iterate over them. Now, to iterate over them a second time, I would have to close the handle, pcopen() again (which does the whole lookup thing again), stores the points in memory and only then I iterate over them again.

I don't know the details of how pcopen() was implemented either, but I'm guessing it just builds a new kd-tree on the same point data. It seems you're thinking about always using a single handle for both iterations, but you shouldn't (at least not if they're nested). Anyway… I had posted some more information in your odForce incarnation of this thread [forums.odforce.net] (sorry, didn't know you'd posted here as well).
Mario Marengo
Senior Developer at Folks VFX [folksvfx.com] in Toronto, Canada.
User Avatar
Member
10 posts
Joined: Sept. 2008
Offline
My intention was actually to use the loops sequentially (not nested). I would never use the same iterator fo a nested loop! Blasphemy! I'll specify it next time.

Nevertheless. I double posted, here (for Houdini developer input on the pcopen implementation) and on odForce for any other advice .

Okay, back to odForce!
  • Quick Links