public void Run(List <FortuneSite> sites, PoolLinkedList <VEdge> edges, double minX, double minY, double maxX, double maxY) { eventQueue.Initialize(5 * sites.Count); beachLine.Clear(); deleted.Clear(); foreach (var s in sites) { var fEvent = ObjectPool <FortuneSiteEvent> .Get(); fEvent.Initialize(s); eventQueue.Insert(fEvent); } //init edge list while (eventQueue.Count != 0) { var fEvent = eventQueue.Pop(); if (fEvent is FortuneSiteEvent) { beachLine.AddBeachSection((FortuneSiteEvent)fEvent, eventQueue, deleted, edges); ObjectPool <FortuneSiteEvent> .Recycle((FortuneSiteEvent)fEvent); } else { if (deleted.Contains((FortuneCircleEvent)fEvent)) { deleted.Remove((FortuneCircleEvent)fEvent); } else { beachLine.RemoveBeachSection((FortuneCircleEvent)fEvent, eventQueue, deleted, edges); } ObjectPool <FortuneCircleEvent> .Recycle((FortuneCircleEvent)fEvent); } } //clip edges var edgeNode = edges.First; while (edgeNode != null) { var edge = edgeNode.Value; var next = edgeNode.Next; var valid = ClipEdge(edge, minX, minY, maxX, maxY); if (!valid) { edges.Remove(edgeNode); if (edgeNode.Value.Neighbor != null) { ObjectPool <VEdge> .Recycle(edgeNode.Value.Neighbor); } ObjectPool <VEdge> .Recycle(edgeNode.Value); } //advance edgeNode = next; } }