Alexandre Kaspar Alexandre Kaspar - 1 year ago 100
C++ Question

Iterating over edges and getting their vertices with OpenMesh

I am starting to use OpenMesh to go through meshes which may have wholes and am wondering what is the good way to actually retrieve the vertices associated with each edge.

For half-edges, there are the methods

of the mesh, but these trigger an error if the opposite half-edge does not exist (we are currently on a boundary half-edge).

Given that I'll encounter these often, what's a better way to iterate over all edges (I actually don't specifically care about half-edge, I'm getting data for each edge, but the direction doesn't matter. What I need are the two vertices)?

Answer Source

I think you can use:

  1. MyMesh::to_vertex_handle(MyMesh::HalfedgeHandle)
  2. MyMesh::from_vertex_handle(MyMesh::HalfedgeHandle)

Please confirm you can find these methods :-)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download