resonanz Posted January 17, 2017 Share Posted January 17, 2017 What is the best HDK equvalent of the neighbours() function in VEX and how do I find all triangles adjacent to edges, which in turn are connected to the same point? Thanks in advance! Quote Link to comment Share on other sites More sharing options...
petz Posted January 17, 2017 Share Posted January 17, 2017 to get neighbouring points you could use GU_Detail::BuildRingZeroPoints() and to get all prims sharing an edge you might want to use GEO_HedgeInterface. it could also be used to get all connected points ... hth. petz Quote Link to comment Share on other sites More sharing options...
resonanz Posted January 17, 2017 Author Share Posted January 17, 2017 Thanks Petz! I found buildRingZeroPoints() in the documentation but I'm having a hard time to understand how GEO_HedeInterface works. I was able to find all neighbour points around my current point but I'm not sure how I can import the edges between those points. Any hint would be helpful. Quote Link to comment Share on other sites More sharing options...
petz Posted January 17, 2017 Share Posted January 17, 2017 (edited) 2 hours ago, resonanz said: Thanks Petz! I found buildRingZeroPoints() in the documentation but I'm having a hard time to understand how GEO_HedeInterface works. I was able to find all neighbour points around my current point but I'm not sure how I can import the edges between those points. Any hint would be helpful. untested but should work: // get 1-ring around points UT_ValArray<GA_OffsetArray> neighbourArray; gdp->buildRingZeroPoints(neighbourArray, NULL); // build HedgeInterface GEO_HedgeInterface hedgeInterface(gdp); // get neighbours of point 0 GA_OffsetArray neighbours = neighbourArray[0]; // init prims GEO_Primitive *prim1, *prim2; // iterate over neighbouring points for(int i = 0; i < neighbours.size(); i++) { // get half-edges between point 0 and neighbour GEO_Hedge hedge = hedgeInterface.findHedgeWithEndpoints(0, neighbours[i]); GEO_Hedge hedgeNext = hedgeInterface.nextEquivalentHedge(hedge); // get prims prim1 = hedgeInterface.hedgePrimitive(hedge); prim2 = hedgeInterface.hedgePrimitive(hedgeNext); } // clean up if(hedgeInterface.haveHedgeTopology()) hedgeInterface.destroyHedgeTopologyLinks(); hth. petz Edited January 17, 2017 by petz 4 Quote Link to comment Share on other sites More sharing options...
resonanz Posted January 18, 2017 Author Share Posted January 18, 2017 Thanks a Million! Works like a charm! 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.