internal static bool AnyIntersections(PlanarGraph <double> graph)
        {
            if (graph == null)
            {
                return(false);
            }
            SegmentGroup <double>        activeEdges = new SegmentGroup <double>();
            IEnumerator <Node <double> > points      = graph.GetEnumerator(); //walk through the points in xy sorted order

            Node <double> nd;
            LeakyResizableArray <Edge <double> > localEdges;

            int           localCt;
            int           activeCt = 0;
            Edge <double> localEdge;
            LineIntersectionResult <double> intersects;
            Point2 <double> localStart;
            Point2 <double> localEnd;
            Point2 <double> activeStart;
            Point2 <double> activeEnd;

            //new point event in the moving front
            while (points.MoveNext())
            {
                nd         = points.Current;
                localEdges = nd.Edges; //edges connected to this point

                localCt = (int)localEdges.Count;

                //compute intersections with other edges in the scan area
                for (int i = 0; i < localCt; i++)
                {
                    localEdge  = localEdges.Data[i];
                    localStart = localEdge.Start.Point;
                    localEnd   = localEdge.End.Point;
                    activeCt   = activeEdges.Edges.Count;

                    foreach (Edge <double> activeEdge in activeEdges)
                    {
                        if (object.ReferenceEquals(localEdge, activeEdge))
                        {
                            continue; //can't have a "full" match -- this is an exiting segment
                        }
                        activeStart = activeEdge.Start.Point;
                        activeEnd   = activeEdge.End.Point;

                        intersects = Coordinate2Utils.GetIntersection(localStart.X, localStart.Y, localEnd.X, localEnd.Y, activeStart.X, activeStart.Y, activeEnd.X, activeEnd.Y);
                        if (intersects.IntersectionType != LineIntersectionType.NoIntersection)
                        {
                            if (intersects.IntersectionType == LineIntersectionType.CollinearIntersection)
                            {
                                return(true); // there's a full segment of intersection
                            }
                            if (object.ReferenceEquals(localEdge.Previous, activeEdge) || object.ReferenceEquals(localEdge.Next, activeEdge))
                            {
                                continue; // this intersection is a single point at the common point of adjacent segments in a chain/ring
                            }
                            return(true);
                        }
                    }
                }
                //remove all exiting segments and add all starting segments
                //Action gets called exactly twice per edge -- once to add it, once to remove it
                for (int i = 0; i < localCt; i++)
                {
                    activeEdges.Action(localEdges.Data[i]);
                }
            }
            return(false);
        }