Get point from a given position.

   4882   6   2
User Avatar
Member
41 posts
Joined: Feb. 2014
Offline
How can I get a point from a given location?

Example:

In : geo.getpointAt()

Out : <hou.Point #32 of geometry frozen at 13311600>
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
does it have to be in python? you could do this in vex quite easily using a pcopen (I cannot remember if python has something to return elements based on position, although you could probably write something quite easily using numpy or hmath)
-G
User Avatar
Member
41 posts
Joined: Feb. 2014
Offline
grayOlorin
does it have to be in python? you could do this in vex quite easily using a pcopen (I cannot remember if python has something to return elements based on position, although you could probably write something quite easily using numpy or hmath)

Yes, it has to be in Python, I already made a script which converts the positions of the pointcloud to a 3d array (vex don't support arrays, that's why I did't do it in VEX).

I was thinking about a method without looping every time to find the point with that specif position. A function in others words
User Avatar
Member
1799 posts
Joined: Oct. 2010
Offline
I could not find a specific nearpoint function in python, however, they do have a hou.Geometry.nearprim() function which returns the closest primitive to a point ID. If you must do it in python, you could use a copy sop to copy primitive spheres into every point before your python process, then the nearprim python function will simply return the closest prim ID, which will be indexed as the closest point

however, although vex does not support arrays, pcopen will simply chew through your points based on distance and return an attribute (or weighted filtered attribute) based on how many hits you find. The for each query position, you can store an attribute which is your point at that position to use later (you can basically use a point cloud as a n dimensional array and even pass it into a python function as such)

I hope these options all help let me know if you need more info
-G
User Avatar
Member
41 posts
Joined: Feb. 2014
Offline
grayOlorin
(you can basically use a point cloud as a n dimensional array and even pass it into a python function as such)

I hope these options all help let me know if you need more info

This is exactly what I did, so I must be on the correct path, :idea:

Unfortanely, the function you mentioned doesn.t apply to my case, but don't worry, you already helped me a lot, thanks very much for taking your time in such rare case.
User Avatar
Member
8592 posts
Joined: July 2007
Offline
nearpoint() function in VEX does that
http://www.sidefx.com/docs/houdini13.0/vex/functions/nearpoint [sidefx.com]

not sure what you mean by VEX not supporting arrays, as it does, but maybe you mean that it doesn't have much functions to work with them?
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
41 posts
Joined: Feb. 2014
Offline
tamte
nearpoint() function in VEX does that
http://www.sidefx.com/docs/houdini13.0/vex/functions/nearpoint [sidefx.com]

Thanks for your asnwer! but I already implemented a different approach, also mentioned by grayOlorin: convert the pointcloud to a 3d dimensional array in numpy
  • Quick Links