Jump to content

Are there simple point cloud iteration examples in VEX?


Recommended Posts

Hi,

I am trying to experiment with point clouds in VEX, since it feels easier to loop, etc in code than in VOPs. Are there any examples that you know of that shows a simple search using a radius and then importing an attribute from each of these found points, and doing something simple with them?

If I get the correct syntax and usage, I can manage from there.

Thanks :)

Link to comment
Share on other sites

Hi,

I am trying to experiment with point clouds in VEX, since it feels easier to loop, etc in code than in VOPs. Are there any examples that you know of that shows a simple search using a radius and then importing an attribute from each of these found points, and doing something simple with them?

If I get the correct syntax and usage, I can manage from there.

Thanks :)

I think vex coding and point cloud operations are used a pretty good amount in this tutorial http://www.cmivfx.com/tutorials/view/330/Houdini+Flocking+Systems

Lemme know if want I could send you some of the code.

Link to comment
Share on other sites

Check out the source files for Peter Quint's point cloud tutorials.

It contains a vop with a custom pc loop, which you could just view in vex code.

https://sites.google.com/site/pqhoudinitutorial/home/houdiniprojectfiles

afaik:

A pc iteration loop is a pc open attached to a while loop that contains a PC iterate connected to the while condition. PC import is used to retrieve attributes from individual pc sample points.

  • Like 2
Link to comment
Share on other sites

Thanks ikarus, I will check out Peter Quint's tutorials. I made some headway yesterday. But the "maxpoints" parameter confuses me. Is it the maximum number of points returned for each point, or the total number of all points that will be returned for the whole VEX operation (for all points)?

Is there a way to specify "return as many as you can find"?

Like if there are points within the search radius for each point that ranges from 0 to 120, I want to get all of them since I already specified a search radius.

Am I thinking wrong? :)

Link to comment
Share on other sites

maxpoints and radius are limits for poincloud query, they are both active all the time

so if you want all points within specified radius set maxpoints to extremely high number like 1e9

and similarly if you want lets say closest 10 points set maxpoints to 10 and radius to extremely high number

btw, if you want exact number of points pointcloud query has returned for current point you can use pcnumfound() function (Point Cloud Num Found VOP)

also search forums for pointclouds there is plenty of examples of iterating through pointclouds in VEX, VOPs, using While Loop, For Loop, No loop at all, in many different scenarios, I think forums are the best resource for this you can find

  • Like 1
Link to comment
Share on other sites

Thanks anim. So the points are returned by distance, from closest the furthest? I thought the order of points weren't guaranteed to be sorted by distance.

I saw the pc num found VOP, but since I can't feed it back to pc open, I didn't use it.

Link to comment
Share on other sites

I didn't say that the points are ordered, I don't consider it guaranteed either, but they are returned based on proximity to point

so it will return closest maxnum of particles from within specified radius

pcnumfound() returns number of particles which met the conditions of pcopen, so pcopen handle is meant to be plugged in no other way around (even though you can plug it to another pcopen if you desire so)

the returned number can be used to loop with the for loop since you know how many points were found (here is one example for that: http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=121576#121576)

  • Like 1
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...