// ================================== Circle Event private static void CircleEvent(Vertex p, List <Point> Q, List <PointSet> T, List <Boundary> V) { // Step 1: Finding the two boundaries of the intersection Boundary Cqr = p.LeftBoundary; Boundary Crs = p.RightBoundary; Site q = Cqr.LeftSite; Site s = Crs.RightSite; Boundary Cuq = null; //Boundary? Boundary Csv = null; //Boundary? int indexCqr = IndexOfBoundary(T, Cqr); if (indexCqr > 1) { Cuq = T[indexCqr - 2] as Boundary; } if (indexCqr < T.Count - 4) { Csv = T[indexCqr + 4] as Boundary; } // Step 2: Creating a new boundary and covering up the boundaries and region from which it starts Boundary Cqs = Boundary.CreateSubtype(q, s); T.RemoveRange(indexCqr, 3); T.Insert(indexCqr, Cqs); CloseVertex(p, Cqr, Crs, Cqs, V); // Step 3: Adding and removing (new) intersections in Q if (Cuq != null) { Q.RemoveAll(point => Boundary.IsIntersection(Cuq, Cqr, point)); } if (Csv != null) { Q.RemoveAll(point => Boundary.IsIntersection(Crs, Csv, point)); } if (Cuq != null) { AddIfNotNull(Q, Cuq.Intersection(Cqs)); } // TODO check adding intersection again if (Csv != null) { AddIfNotNull(Q, Cqs.Intersection(Csv)); } }