GreenAvoy Posted November 22, 2018 Share Posted November 22, 2018 Good day everyone! For now I can introduce you another, I guess, simple thing. it's a fully procedural model and I'm trying to connect all "corner points" to all "wall primitives" and get one close shape with same amount and position of points on this shape. Below attached pictures of what I have at the current time and how (as example) that expecting to be at the end. Does anybody know how to solve that stage? Any possibility to do that with SOP\VOP nodes, or VEX is essential? Thank you Quote Link to comment Share on other sites More sharing options...
Aizatulin Posted November 22, 2018 Share Posted November 22, 2018 Hi, one possible solution can be connecting the points by neighbourcount (attribute). To avoid connecting the wrong points, all possible distances between all point pairs can be sorted to define a maximum distance from the right value of the sorted array. line_add.hipnc Quote Link to comment Share on other sites More sharing options...
GreenAvoy Posted November 22, 2018 Author Share Posted November 22, 2018 33 minutes ago, Aizatulin said: Hi, one possible solution can be connecting the points by neighbourcount (attribute). To avoid connecting the wrong points, all possible distances between all point pairs can be sorted to define a maximum distance from the right value of the sorted array. line_add.hipnc Thanks for reply, Aizatulin! With this code in "attribWrangler" node I have that kind of issues: int n = npoints(0); int zero[]; int one[]; int c; // zero ~ isolated points // one ~ end points (with only one neighbour) for (int i = 0; i < n; i++) { c = point(0, 'n', i); if (c == 0) { push(zero, i); } if (c == 1) { push(one, i); } } n = len(zero); int l = len(one); float dist[]; vector V,W; float d; // calculate all possible distances between zero and one for (int i = 0; i < n; i++) { V = point(0, 'P', zero); for (int k = 0; k < l; k++) { W = point(0, 'P', one[k]); d = length(W - V); push(dist, d); } } // sort distances sort(dist); // the n * 2 - smallest value should be the maximum distance float maxdist = dist[n * 2 - 1]; int line; // now connect all points with a smaller distance than maxdist // zero <-> one[k], if distance is small enough for (int i = 0; i < n; i++) { line = addprim(0, “polyline”); V = point(0, 'P', zero); for (int k = 0; k < l; k++) { W = point(0, 'P', one[k]); d = length(W - V); if (d <= maxdist) { addvertex (0, line, zero); addvertex (0, line, one[k]); } } } ____________________________________________ Issues: Error: The sub-network output operator failed to cook: /obj/curve_object1/by_dist/attribvop1 Error: Vex error: /obj/curve_object1/by_dist/attribvop1/snippet1: Syntax error, unexpected end of file. (46,27) Failed to resolve VEX code op:/obj/curve_object1/by_dist/attribvop1. ...On top of that I could say that I am absolutely zero in scripting... :c Maybe that errors cause I use old version of Houdini (v13) cause of my PC. Quote Link to comment Share on other sites More sharing options...
pxptpw Posted November 23, 2018 Share Posted November 23, 2018 (edited) one way of doing this would be, with the a couple of foreach loop nodes every line would have a start which is 0 and the end, number of points -1 , and then you can use the fuse sop to connect between the points , this is the bear bones of achieving this or search closest point and add a line , fuse them , resample points, file below joinconnect.hiplc Edited November 23, 2018 by pxptpw Quote Link to comment Share on other sites More sharing options...
GreenAvoy Posted November 25, 2018 Author Share Posted November 25, 2018 On 11/23/2018 at 2:40 PM, pxptpw said: one way of doing this would be, with the a couple of foreach loop nodes every line would have a start which is 0 and the end, number of points -1 , and then you can use the fuse sop to connect between the points , this is the bear bones of achieving this or search closest point and add a line , fuse them , resample points, file below joinconnect.hiplc Thanks for reply! ...My H v13 cannot open this file, sorry >.< Quote Link to comment Share on other sites More sharing options...
Jesper Rahlff Posted December 17, 2018 Share Posted December 17, 2018 you could use the Polypath node. Might have to use a join node first after merging. 1 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.