SubjectEgo Posted April 28, 2008 Share Posted April 28, 2008 I'm having trouble finding a solution to a problem. I have a point group in my file, which I need to behave in a particular manner. To get the behavior I need, the points need to be aware of neighboring points, and act accordingly. For example, for each point in the group, the positions of all points within a certain distance will have their relative positions fed into an algorithm. The result from this will be used to move the current point through space in relation to that result, and, in effect, in relation to the neighboring points. However, I'm not sure how to achieve that. Within a VEX POP, I don't know how to bring in the positions of points other than the one currently being evaluated, let alone isolate the points that fall within a certain distance from that point. It's been recommended that I use a Point Cloud, but I have found ZERO reference for how Point Clouds are used. The local Houdini Help Documentation does not contain the relevant information, and the Wiki here has not yielded anything useful (some of the would-be useful links are broken). Quote Link to comment Share on other sites More sharing options...
symek Posted April 28, 2008 Share Posted April 28, 2008 (edited) I'm having trouble finding a solution to a problem. I have a point group in my file, which I need to behave in a particular manner. To get the behavior I need, the points need to be aware of neighboring points, and act accordingly. For example, for each point in the group, the positions of all points within a certain distance will have their relative positions fed into an algorithm. The result from this will be used to move the current point through space in relation to that result, and, in effect, in relation to the neighboring points.However, I'm not sure how to achieve that. Within a VEX POP, I don't know how to bring in the positions of points other than the one currently being evaluated, let alone isolate the points that fall within a certain distance from that point. It's been recommended that I use a Point Cloud, but I have found ZERO reference for how Point Clouds are used. The local Houdini Help Documentation does not contain the relevant information, and the Wiki here has not yielded anything useful (some of the would-be useful links are broken). I'm ashamed for myself, I'm selling this code twice a week, although it's really trivial. Look at the very bottom here: http://forums.odforce.net/index.php?showto...non-overlapping This is a sop VEX code, but to turn in into a pop VEX, I think it's enough to change declaration, so: // We need at least one variable, point cloud map. In SOPs and POPs this can be preceding // operator (not a file on disk), specified with a trick:" op:/`opinputpath(".", 0)` " in a string // parameter. pop nearestPointPC(string pointcloud="") { // Here I assumed that farthest possible distance between points is a bbox: vector min, max; float tmpdist; getbbox(min, max); float dist = distance(min, max); // Open a PC "around" current P coordinates, and retrieve 2 closest neighbours: // again: point cloud doesn't have to exist on disk... int handle = pcopen(pointcloud, "P", P, dist, 2); // Iterate through points returned by pcopen() while (pciterate(handle) ) { vector pos; // import position of a point. I also suspect (?) that the first one // will be *our point, so I'm trying to omit first match: pcimport(handle, "P", pos); if ( P != pos ) { // There are two spacial attribs: point.distance and point.number // you can import besides any other owned by a point in query: pcimport(handle, "point.distance", tmpdist); // I needed only to save the shortest distance to a point attribute: // Perhaps this is a place for your fancy, rocket science algorithm: addattribute("distance", tmpdist); } } } I think there are some examples how to deal with PC in Help. Did you search for a pcopen? Hope this helps, Simon. Edited April 28, 2008 by SYmek 1 Quote Link to comment Share on other sites More sharing options...
sibarrick Posted April 28, 2008 Share Posted April 28, 2008 Check out the neighbour and neighbour count vops (getneighbour and getneighbourcount vex functions) too, they will give you the connected points rather than just the ones within a given radius. Quote Link to comment Share on other sites More sharing options...
SubjectEgo Posted April 28, 2008 Author Share Posted April 28, 2008 How might I achieve the same results using a node-based approach? I'd like to understand how the same information would flow through a VOP Network / POP Type setup. Quote Link to comment Share on other sites More sharing options...
symek Posted April 29, 2008 Share Posted April 29, 2008 How might I achieve the same results using a node-based approach? I'd like to understand how the same information would flow through a VOP Network / POP Type setup. Don't ask me to do this . It's fully doable In VOPs. You need nodes like: Point Cloud Open, Point Cloud Iterate, While, Compare, Point Cloud Import and a few others. Good luck . After all this snippet has ~8 lines of workable code. Rest are {} or comments. Quote Link to comment Share on other sites More sharing options...
petz Posted April 29, 2008 Share Posted April 29, 2008 i vop_points.hipnc Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.