private static List<EdgeAggregator> CheckAndGenerateParallelImplyAlternateInterior(Intersection inter1, Intersection inter2, Parallel parallel) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // The two intersections should not be at the same vertex if (inter1.intersect.Equals(inter2.intersect)) return newGrounded; // Determine the transversal Segment transversal = inter1.AcquireTransversal(inter2); if (transversal == null) return newGrounded; // // Ensure the non-traversal segments align with the parallel segments // Segment parallel1 = inter1.OtherSegment(transversal); Segment parallel2 = inter2.OtherSegment(transversal); // The non-transversals should not be the same (coinciding) if (parallel1.IsCollinearWith(parallel2)) return newGrounded; Segment coincidingParallel1 = parallel.CoincidesWith(parallel1); Segment coincidingParallel2 = parallel.CoincidesWith(parallel2); // The pair of non-transversals needs to align exactly with the parallel pair of segments if (coincidingParallel1 == null || coincidingParallel2 == null) return newGrounded; // Both intersections should not be referring to an intersection point on the same parallel segment if (parallel.segment1.PointLiesOn(inter1.intersect) && parallel.segment1.PointLiesOn(inter2.intersect)) return newGrounded; if (parallel.segment2.PointLiesOn(inter1.intersect) && parallel.segment2.PointLiesOn(inter2.intersect)) return newGrounded; // The resultant candidate parallel segments shouldn't share any vertices if (coincidingParallel1.SharedVertex(coincidingParallel2) != null) return newGrounded; if (inter1.StandsOnEndpoint() && inter2.StandsOnEndpoint()) { // // Creates a basic S-Shape with standsOnEndpoints // // offThis ______ // | // offThat ______| // // Return <offThis, offThat> KeyValuePair<Point, Point> cShapePoints = inter1.CreatesBasicCShape(inter2); if (cShapePoints.Key != null && cShapePoints.Value != null) return newGrounded; // // Creates a basic S-Shape with standsOnEndpoints // // ______ offThat _______ // | \ // offThis ______| _____\ // // Return <offThis, offThat> KeyValuePair<Point, Point> sShapePoints = inter1.CreatesBasicSShape(inter2); if (sShapePoints.Key != null && sShapePoints.Value != null) { return GenerateSimpleS(parallel, inter1, sShapePoints.Key, inter2, sShapePoints.Value); } return newGrounded; } // _______/________ // / // / // ______/_______ // / if (inter1.Crossing() && inter2.Crossing()) return GenerateDualCrossings(parallel, inter1, inter2); // No alt int in this case: // Creates an F-Shape // top // _____ offEnd <--- Stands on Endpt // | // |_____ offStands <--- Stands on // | // | // bottom KeyValuePair<Point, Point> fShapePoints = inter1.CreatesFShape(inter2); if (fShapePoints.Key != null && fShapePoints.Value != null) return newGrounded; // Alt. Int if an H-Shape // // | | // |_____| // | | // | | // if (inter1.CreatesHShape(inter2)) return GenerateH(parallel, inter1, inter2); // Creates an S-Shape // // |______ // | // ______| // | // // Order of non-collinear points is order of intersections: <this, that> KeyValuePair<Point, Point> standardSShapePoints = inter1.CreatesStandardSShape(inter2); if (standardSShapePoints.Key != null && standardSShapePoints.Value != null) { return GenerateSimpleS(parallel, inter1, standardSShapePoints.Key, inter2, standardSShapePoints.Value); } // Corresponding if a flying-Shape // // | | // |_____|___ offCross // | | // | | // Point offCross = inter1.CreatesFlyingShapeWithCrossing(inter2); if (offCross != null) { return GenerateFlying(parallel, inter1, inter2, offCross); } // // Creates a shape like an extended t // offCross offCross // | | // _____|____ ______|______ // | | // |_____ offStands offStands _____| // // Returns <offStands, offCross> KeyValuePair<Point, Point> tShapePoints = inter1.CreatesCrossedTShape(inter2); if (tShapePoints.Key != null && tShapePoints.Value != null) { return GenerateCrossedT(parallel, inter1, inter2, tShapePoints.Key, tShapePoints.Value); } // // Creates a Topped F-Shape // top // offLeft __________ offEnd <--- Stands on // | // |_____ off <--- Stands on // | // | // bottom // // Returns: <bottom, off> KeyValuePair<Intersection, Point> toppedFShapePoints = inter1.CreatesToppedFShape(inter2); if (toppedFShapePoints.Key != null && toppedFShapePoints.Value != null) { return GenerateToppedFShape(parallel, inter1, inter2, toppedFShapePoints.Key, toppedFShapePoints.Value); } return newGrounded; }