Ejemplo n.º 1
0
        public static bool DoBreakpointsConverge(CircleEvent circleEvent)
        {
            bool clockwise = (circleEvent.L().GetNode().y - circleEvent.C().GetNode().y)
                             * (circleEvent.R().GetNode().x - circleEvent.C().GetNode().x) <=
                             (circleEvent.L().GetNode().x - circleEvent.C().GetNode().x)
                             * (circleEvent.R().GetNode().y - circleEvent.C().GetNode().y);

            if (clockwise)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }