Jump to content
resonanz

Adjacent primitives in HDK

Recommended Posts

resonanz    0

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!

Share this post


Link to post
Share on other sites
petz    306

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 this post


Link to post
Share on other sites
resonanz    0

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 this post


Link to post
Share on other sites
petz    306
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 by petz
  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×