private void HandleSiteEvent(SiteEvent siteEvent) { EventTree.TreeNode node = _eventTree.GetClosest(this, _eventTree.GetRoot(), siteEvent); if (node == null || node is EventTree.BreakpointNode) { return; } EventTree.LeafNode closest = (EventTree.LeafNode)node; if (closest.GetDisappearEvent() != null) { _eventQueue.Delete(closest.GetDisappearEvent().GetHandle()); closest.SetDisappearEvent(null); } List <CircleEvent> circleEvents2 = _eventTree.InsertNewSiteEvent(closest, new TreeItem(siteEvent.V())); foreach (var ce in circleEvents2) { IPriorityQueueHandle <IEvent> h = null; _eventQueue.Add(ref h, ce); ce.SetHandle(h); } }
private void HandleCircleEvent(CircleEvent circleEvent) { HalfEdge CL = circleEvent.L().GetHalfEdge(); if (CL.GetFace() == circleEvent.L().GetNode()) { CL = CL.Twin(); } HalfEdge CR = circleEvent.C().GetHalfEdge(); if (CR.GetFace() == circleEvent.R().GetNode()) { CR = CR.Twin(); } HalfEdge RC = CR.Twin(); RC.SetTarget(circleEvent); CL.SetTarget(circleEvent); circleEvent.halfEdge = CR; EventTree.LeafNode prev = (EventTree.LeafNode)_eventTree.GetPreviousLeaf(circleEvent.GetCenterLeafNode()); EventTree.LeafNode next = (EventTree.LeafNode)_eventTree.GetNextLeaf(circleEvent.GetCenterLeafNode()); if (prev != null) { if (prev.GetDisappearEvent() != null) { _eventQueue.Delete(prev.GetDisappearEvent().GetHandle()); prev.SetDisappearEvent(null); } } if (next != null) { if (next.GetDisappearEvent() != null) { _eventQueue.Delete(next.GetDisappearEvent().GetHandle()); next.SetDisappearEvent(null); } } List <CircleEvent> newCircles = _eventTree.RemoveNode(circleEvent, prev, circleEvent.GetCenterLeafNode(), next); if (newCircles != null) { foreach (CircleEvent ce in newCircles) { IPriorityQueueHandle <IEvent> h = null; _eventQueue.Add(ref h, ce); ce.SetHandle(h); } } }