elenvou Posted June 11, 2018 Share Posted June 11, 2018 Hi! I want to trace the adjacent triangles of an icosahedron in order to find the average of their values and equalize them. Any ideas? neighbors multiple values.hipnc Quote Link to comment Share on other sites More sharing options...
Wooshum Posted June 12, 2018 Share Posted June 12, 2018 (edited) Looks like you were on the right track with the use of half edges. You could approach the problem using a primitive wrangle as follows: // Array of neighbouring prims int prim_neighbours[]; // Loop through the primitives vertices foreach (int vtx; primvertices(0, @primnum)) { // Get the forward half edge for the vertex int this_hedge = vertexhedge(0, vtx); // Only process if a valid half edge if (hedge_isvalid(0, this_hedge)) { int equiv_hedge = this_hedge; // Loop through equivalent half edges and get the neighbouring prims do { equiv_hedge = hedge_nextequiv(0, equiv_hedge); if (equiv_hedge != this_hedge) { // !! Get your attribues here !! push(prim_neighbours, hedge_prim(0, equiv_hedge)); } } while (equiv_hedge != this_hedge); } } i[]@neighbours = prim_neighbours; Edited June 12, 2018 by Wooshum Code mistake 1 Quote Link to comment Share on other sites More sharing options...
elenvou Posted June 12, 2018 Author Share Posted June 12, 2018 Thank you very much Dan! Now, I am able to see the list of the neighbours on points but still, I can't see it in the primitives. Do you know what can be wrong? Quote Link to comment Share on other sites More sharing options...
Wooshum Posted June 12, 2018 Share Posted June 12, 2018 Are you operating on primitives instead of points? Have attached an example hip. prim_neighbours.hiplc Quote Link to comment Share on other sites More sharing options...
elenvou Posted June 12, 2018 Author Share Posted June 12, 2018 Oh yes, I keep forgetting that! thanks a lot! It works great!! Quote Link to comment Share on other sites More sharing options...
3dome Posted June 12, 2018 Share Posted June 12, 2018 another way: //primwrangle int pt = addpoint(0, @P); //center for each primitive removeprim(0, @primnum, 1); //we just want the new created points connect adjacent pieces with type set to adj. points. set radius to correct value to not get too many connections. unit icosahedron would be 0.3 for example //pointwrangle int nb[] = neighbours(0, @ptnum); //this array is the neighours for each point. point numbers correspond to prim numbers Quote Link to comment Share on other sites More sharing options...
elenvou Posted June 12, 2018 Author Share Posted June 12, 2018 Dan, one more question. It seems that now I have a list of points and a list of primitives with 5 attributes instead of three. I guess it is because I found the adjacent points. How can I create a list with the adjacent primitives - triangles? Quote Link to comment Share on other sites More sharing options...
Wooshum Posted June 12, 2018 Share Posted June 12, 2018 The number of neigbouring primitives returned is dependent on the number of edges each primitive (as in face/polygon) shares with another primitive. So in your example a Dodecahedron will return 5 neighbours per prim as each face has 5 shared edges. If you start with a Icosahedron you will return 3 neighbours per prim, etc. Primitives in houdini are n-sided polygons so can have any number of shared edges. Quote Link to comment Share on other sites More sharing options...
vinyvince Posted July 26, 2021 Share Posted July 26, 2021 (edited) Building from myself some hardsurface procedural methods, one issue i have.. Is it possible to filter generated clusters? Merging small cluster which area is too small or area too stretched to the most adjacent cluster? Off course, it's also hard to know if the cluster has to be removed or not . I mean in mure term of design, the size should not be the only element to take into consideration, but that's off couse another more complex question Might i ask if that speak to you ? Thanks you ! @Wooshum @3dome @f1480187 @petz @konstantin magnus ________________________________________________________________ Vincent Thomas (VFX and Art since 1998) Senior Env and Lighting artist & Houdini generalist & Creative Concepts http://fr.linkedin.com/in/vincentthomas Edited July 26, 2021 by vinyvince Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted July 26, 2021 Share Posted July 26, 2021 Hi Vincent, this could be what you mean: 1 Quote Link to comment Share on other sites More sharing options...
vinyvince Posted July 27, 2021 Share Posted July 27, 2021 Thanks @konstantin magnus. Totalyl agree with you on your comment, sadly here the clustering is not based on the voronoi diagram, i know already these tricks but i can't apply it here. Even with clean geo, it could creat some small pocket areas you may not want. Basically how i see will be to loop to eachpiece, if the area or stretch value is under a certain value, look around (point cloud ) to find the neighbour cluster, pick the best one, and change the cluster attribute value of the considering unwanted area. I guess there is not need to shift the cluster value as some will be missing in the total amount. Now will be to vexify this method. Sam thing coudl be apply to merge small group actually. A second probably more tricky point is, how to define "stretched area"? One with quite different ratio? Not easy in a non planar space... At least when you have an artistic approach 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.