FaceCount MaximumFan(HalfEdge eOrig)
{
/* eOrig.Lface is the face we want to render. We want to find the size
* of a maximal fan around eOrig.Org. To do this we just walk around
* the origin vertex as far as possible in both directions.
*/
FaceCount newFace = new FaceCount(0, null, new FaceCount.RenderDelegate(RenderFan));
Face trail = null;
HalfEdge e;
for (e = eOrig; !e.leftFace.Marked(); e = e.nextEdgeCCWAroundOrigin)
{
Face.AddToTrail(ref e.leftFace, ref trail);
++newFace.size;
}
for (e = eOrig; !e.rightFace.Marked(); e = e.Oprev)
{
Face f = e.rightFace;
Face.AddToTrail(ref f, ref trail);
e.rightFace = f;
++newFace.size;
}
newFace.eStart = e;
Face.FreeTrail(ref trail);
return newFace;
}