Jul 18, 2014 at 1:10 PM
Edited Jul 18, 2014 at 1:18 PM

This should only happen if the cell is open, ie. face.Bounded == false . Surely needs some documentation, but it makes sense:
The code above will traverse all edges of the DCEL face counterclockwise. If the face is unbounded there are exactly two (half)infinite edges. In this case,
edge = face.Edge will be the first infinite edge. edge.Origin is an
infinite vertex, i.e. offically not part of the diagram. edge.Twin.Origin is the starting point of the infinite egde, so the
infinite vertex is needed to know its direction.
If you reach the last infinite edge of the cell, edge.Next will be null.
edge.Origin is the starting point of the infinite egde and edge.Twin.Origin is again an
infinite vertex, lying in the direction of the infinite edge.
There are two possible ways to go:
 Add a check
while (edge != null && edge.Origin.ID != first) for unbounded cells.
 Use the bounded Voronoi diagram. Just add all your points into a manually added bounding box.
That's probably the last thing to do before publishing Beta 4: adding the option to intersect the standard Voronoi diagram with a bounding box, so all cells get closed.
PS: I think DCELs are quite awesome, so once you get your head around them, the insertion of a new cell won't be too hard ... it's all about careful bookkeeping of the edge pointers.
