## Recommended Posts

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?

##### Share on other sites

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

##### Share on other sites

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.

##### Share on other sites
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())

hth.

petz

Edited by petz
• 3

##### Share on other sites

Thanks a Million! Works like a charm!

## Create an account

Register a new account