select primitive based on scattered points

   2423   4   1
User Avatar
Member
41 posts
Joined: 5月 2010
Offline
Hi Houdini lovers

I have a poly geometry and I scatter a bunch of points on it.
Now I want to select the primitives that those scattered points are on them.
What is the fastest and easiest way to do it?

Cheers
User Avatar
Member
512 posts
Joined: 7月 2009
Offline
there's a couple ways of doing it, you could i.e. transfer a color from the scattered points to the prims based on distance and then write in a Group SOP in the expression field something like $CR > .9 (your primgeo needs to be black before you transfer a red color to it).
Or
You go fancy and use a combinations of expressions and python,
check out the file that I attached!

cheers,

Manu

Attachments:
Python_convert_list_to_string.hipnc (48.3 KB)

http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
41 posts
Joined: 5月 2010
Offline
Thanks Manuel!
That's what exactly I want
but can you please explain the python code to me? I mean what is the purpose of the program and how it works.
also in the nearestPrim node, you used the pointdist() method. for the prim number you entered -1. what does that mean?
User Avatar
Member
512 posts
Joined: 7月 2009
Offline
I put some explanations into the code so you know what's going on there.
As for the pointdist() expression, -1 means that you look at all primitives instead of only one, and 3 means to return the nearest primitive that is found.
In order to know about the expression syntax, open a textport window in Houdini and type “exhelp pointdist” !

Attachments:
Python_convert_list_to_string_explained.hipnc (49.2 KB)

http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
41 posts
Joined: 5月 2010
Offline
thanks again!
it's funny that I read the help for pointdist and even read what 3 means for the return value, but I missed the -1

awesome explanation on the code as well!
I appreciate it.
  • Quick Links