Search code examples
data-structuresgraphicsmesh

How to find the two boundary edges of a boundary vertex in the half edge data structure?


enter image description here

I can find the most counter clock wise by simply doing:

while (edge && edge->twin()) {
  edge = edge->twin()->next()
}

but I'm not able to find a way by traversing the edges to get the second edge, basically find the other extreme (clock wise edge)

ref: http://www.flipcode.com/archives/The_Half-Edge_Data_Structure.shtml


Solution

  • Check if edge->prev()->twin() exists. If it does, go there and iterate. If not, edge->prev() is your boundary half edge.