PDA

View Full Version : Mesh Graph (more than vertex position info)


jpriede
05-03-2013, 07:48 AM
Hello, I know I can get the xyz position of any given vertex in a model, but I would love to be able to know which vertecies are "neighbours" of vertex X.

For those math folks out there, I want the full graph of the mesh.

Something like (pseudocode/java...):

Vertex {
ArrayList<Vertex> NeighbouringVertecies;
float xPos;
float yPos;
float zPos;
float uTexCoord;
float vTexCoord;
}

So, if I say byMagic.getVertex(0) I get a vertex object that not only knows where it is, but also which vertecies within the overall mesh it is connected to, so I could do byMagic.getVertex(0).getNeighbour(0).getXPos() or byMagic.getVertex(0).getNeighbours() that would return a list of neighbours.

Basically, I want to be able to conceptually "travel" along edges to "find" an arbitrary vertex.