Skip to main content

Finding adjacent points (verts) in DirectX

Submitted by axon on
Forum

Hi all,

I'm playing with mass-spring stuff and need to know which verts are adjacent to any given vert.

At the moment I've no problem getting the indices of adjacent tris but cannot figure out how to get the point indices from the triangle indices (since I can't assume that the vert buffer is tri-list, tri-soup, or tri-fan).

I've had a look at
[code]pMesh->ConvertAdjacencyToPointReps(&adjacencyBuffer, &pointAdjacency)[/code]but I don't understand what the returned pointAdjacency represents (and how to use it to lookup the coords of any vert's neighbouring verts):

For a cube I get the following:
TriAdjacency[36] = (6,9,1,2,10,0,1,9,3,4,10,2,3,8,5,7,11,
4,0,11,7,5,8,6,7,4,9,2,0,8,1,3,11,5,6,10)
PointAdj[36] = (0,1,2,3,3,2,6,7,7,6,10,11,1,0,11,10,1,10,
6,2,0,3,7,11,0,0,0,0,0,0,0,0,0,0,0,0);

But this doesn't make sense: How can the first point 0 have adjacent points 0,1,2?
Or, taken another way, how can tri 6 have points 0,1,2?

TriAdjacency has 36 elements. This is because there are 2 tris for each of the 6 faces and each tri has 3 neighbours (2 * 6 * 3 = 36).

I'm looking for the meaning of the "point representatives" (quote from the SDK) labelled as PointAdj above.

The first 24 numbers are the useful data. 24 makes sense because there are 8 corners (verts) on a cube and each has 3 adjacent verts (forming 3 edges that converge at that point). 8 points * 3 neighbours for each point = 24 indices.

But if you try to interpret the sequence in the same way as the triAdj sequence by taking it in sets of 3, there are many sets which appear invalid. No number should be repeated in any set of 3.. but there is 3,3,2 and 6,7,7. Note also that the following numbers do not appear at all: 4,5,8,9,12,13,14,15,16,17,18,19,20,21,22,23. (the cube is made up of 24 points).

Can anyone shed some light on how to interpret the pointAdj sequence in order to get my adjacent points?

Thanks in adv. Greg

Posted by axon on
Forum

Hi all,

I'm playing with mass-spring stuff and need to know which verts are adjacent to any given vert.

At the moment I've no problem getting the indices of adjacent tris but cannot figure out how to get the point indices from the triangle indices (since I can't assume that the vert buffer is tri-list, tri-soup, or tri-fan).

I've had a look at
[code]pMesh->ConvertAdjacencyToPointReps(&adjacencyBuffer, &pointAdjacency)[/code]but I don't understand what the returned pointAdjacency represents (and how to use it to lookup the coords of any vert's neighbouring verts):

For a cube I get the following:
TriAdjacency[36] = (6,9,1,2,10,0,1,9,3,4,10,2,3,8,5,7,11,
4,0,11,7,5,8,6,7,4,9,2,0,8,1,3,11,5,6,10)
PointAdj[36] = (0,1,2,3,3,2,6,7,7,6,10,11,1,0,11,10,1,10,
6,2,0,3,7,11,0,0,0,0,0,0,0,0,0,0,0,0);

But this doesn't make sense: How can the first point 0 have adjacent points 0,1,2?
Or, taken another way, how can tri 6 have points 0,1,2?

TriAdjacency has 36 elements. This is because there are 2 tris for each of the 6 faces and each tri has 3 neighbours (2 * 6 * 3 = 36).

I'm looking for the meaning of the "point representatives" (quote from the SDK) labelled as PointAdj above.

The first 24 numbers are the useful data. 24 makes sense because there are 8 corners (verts) on a cube and each has 3 adjacent verts (forming 3 edges that converge at that point). 8 points * 3 neighbours for each point = 24 indices.

But if you try to interpret the sequence in the same way as the triAdj sequence by taking it in sets of 3, there are many sets which appear invalid. No number should be repeated in any set of 3.. but there is 3,3,2 and 6,7,7. Note also that the following numbers do not appear at all: 4,5,8,9,12,13,14,15,16,17,18,19,20,21,22,23. (the cube is made up of 24 points).

Can anyone shed some light on how to interpret the pointAdj sequence in order to get my adjacent points?

Thanks in adv. Greg