Difference between MeshFace Vertices & TopologicalVertices?

No, unfortunately. I don’t remember from which code example that code snippet was.

But to explain that single row of code I made an illustration to show how Mesh.TopologyVertices relates to Mesh.Vertices.

TopologyVertices typically represents a “location”, say the center of the illustrated eight-faced group. The face group has altogether 8 faces, which makes for nine (9) “locations” (corners). (The illustrated faces are shown on different levels to give some room for the numbering). All the red dots should have the same coordinates, or, "stacked on top of each other).

*Fig 1. TopologyVertices stores references (red table) to the actual Vertices list via its two-dimensional arrays. The red table below is shamelessly trying to represent the Mesh.TopologyVertices.MeshVertextindices function which returns each array from the red table):

The 9:th location in the center has index 8 in the illustration (green = Topology vertices)

Now the following code example should make sense:

{
    i = 8;
    // pick first vertex in array
    Point3f p =     Mesh.Vertices[Mesh.TopologyVertices.MeshVertexIndices(i)[0]]; 

    // Or, more readable step for step:

    var TV = Mesh.TopologyVertices;
    int[] v_indices = TV.MeshVertexIndices(i);
    int vertex_at = v_indices[0];
    Point3f p = Mesh.Vertices[ vertex_at ]; 
}

TopologyVertices only references the “real” or actual vertices which are contained in the Mesh.Vertices list.

In the illustration all faces are “unwelded”, which means they do not share vertices, so each individual corner has it’s own vertex. But the number of TopologyVertices are still the same (it still has only 8 “locations”, although the underlaying vertices are stacked on top of each other).

Now, if you want to grab one actual vertex in any of the location, you do not know beforehand if the location is welded (whether all corners share one single underlaying vertex) but regardless of how many vertices are stacked on top of each other, the best bet is to always pick the first one since there will always be at least one vertex in a location. So, no matter if the index 8 of TopologyVertices has an array of 8 other index references to the “real” Vertices table, just pick the first index and you have at least one location coordinate.

// Rolf

Edit: Misspelled property

4 Likes