//////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> Create a circle event from a triple of leaf nodes. </summary> /// <remarks> Darrellp, 2/18/2011. </remarks> /// <param name="lfnLeft"> Leaf node representing the leftmost parabola. </param> /// <param name="lfnCenter"> Leaf node representing the center parabola. </param> /// <param name="lfnRight"> Leaf node representing the rightmost parabola. </param> /// <param name="yScanLine"> Where the scan line is located. </param> /// <param name="evq"> Event queue. </param> //////////////////////////////////////////////////////////////////////////////////////////////////// private static void CreateCircleEventFromTriple( LeafNode lfnLeft, LeafNode lfnCenter, LeafNode lfnRight, double yScanLine, EventQueue evq) { // This happens if we're the farthest right or left parabola... if (lfnLeft == null || lfnRight == null || lfnCenter == null) { // No circle events associated with non-existent parabolas return; } // We need at least three points if (lfnRight == lfnCenter || lfnRight == lfnLeft || lfnCenter == lfnLeft) { // If two of the points are identical then we don't have three points return; } // Make sure we don't insert the same circle eventin twice if (ICcwVoronoi(lfnLeft.Poly.VoronoiPoint, lfnCenter.Poly.VoronoiPoint, lfnRight.Poly.VoronoiPoint) > 0) { // Don't create an event if we've already put it in before return; } // Create the circle event var cevt = FortuneEvent.CreateCircleEvent(lfnLeft.Poly, lfnCenter.Poly, lfnRight.Poly, yScanLine); // If we got a valid circle event if (cevt != null) { // Indicate which leaf node gets snuffed when this event is handled cevt.LfnEliminated = lfnCenter; // Add it to the event queue evq.AddCircleEvent(cevt); // Let the center node know this event will bring about its ominous demise lfnCenter.SetCircleEvent(cevt); } }