private static void FindNewEvent(Segment s1, Segment s2, EventPoint eventPoint, RBTreeMap <EventPoint, LinkedList <Segment> > eventQueue) { //If two segments intersect below the sweep line, or on it and //to the right of the current event point, and the intersection //is not yet present as an event in Q: //then insert a new event point in Q for this intersection VecRat2 pointIntersection = new VecRat2(); SegRat2 segmentIntersection = new SegRat2(); //bool intersectionExists = Segment.ComputeIntersection(s1, s2, out pointIntersection); //if (intersectionExists) SegmentIntersectionType result = GeomAid.SegmentIntersection(s1.ToSegRat2(), s2.ToSegRat2(), ref pointIntersection, ref segmentIntersection); if (result == SegmentIntersectionType.Point) { EventPoint newEventPoint = new EventPoint(null); newEventPoint.Position = pointIntersection; if (eventPoint.CompareTo(newEventPoint) < 0 && !eventQueue.ContainsKey(newEventPoint)) { LinkedList <Segment> upperList = new LinkedList <Segment>(); eventQueue.Add(new RBTreeMapNode <EventPoint, LinkedList <Segment> >(newEventPoint, upperList)); } } else if (result == SegmentIntersectionType.Segment) { throw new NotImplementedException("Didn't think this would ever happen?!"); } }
private void FindNewEventPoint(OA_Segment segment1, OA_Segment segment2, OA_EventPoint eventPoint) { VecRat2 pointIntersection = new VecRat2(); SegRat2 segmentIntersection = new SegRat2(); SegmentIntersectionType result = GeomAid.SegmentIntersection(segment1.ToSegRat2(), segment2.ToSegRat2(), ref pointIntersection, ref segmentIntersection); if (result == SegmentIntersectionType.Point) { OA_EventPoint newEventPoint = new OA_EventPoint(pointIntersection); if (eventPoint.CompareTo(newEventPoint) < 0) { //Add the new event point if it isn't already in the event queue eventQueue.Add(new RBTreeSetNode <OA_EventPoint>(newEventPoint)); } } else if (result == SegmentIntersectionType.Segment) { throw new NotImplementedException("Didn't think this would ever happen?!"); } }