Search code examples
computational-geometrymeshvertexopenmesh

OpenVolumeMesh, how to get coordinates from VertexHandle?


I'm using OpenVolumeMesh and have so far been unable to figure out how to get the actual x, y, z coordinates from a VertexHandle. I have the following:

VertexHandle vh0 = mesh.halfedge(*he_it).from_vertex();
VertexHandle vh1 = mesh.halfedge(*he_it).to_vertex();

In OpenMesh, I could get a point using something like:

myPoint = mesh.point(*fvit++);
float x = myPoint[0];
float y = myPoint[1];
float z = myPoint[2];

How would I go about doing the same in OpenVolumeMesh?


Solution

  • In OpenVolumeMesh the function returning the position is called vertex. Other than that you can access the coordinates in the same way.

    auto myPoint = mesh.vertex(*fvit++);
    float x = myPoint[0];
    float y = myPoint[1];
    float z = myPoint[2];