private static List <EdgeAggregator> InstantiateToTheorem(Trapezoid trapezoid, GroundedClause original) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // If median has not been checked, check now if (!trapezoid.IsMedianChecked()) { trapezoid.FindMedian(); } // Generate only if the median is valid (exists in the original figure) if (!trapezoid.IsMedianValid()) { return(newGrounded); } GeometricParallel newParallel1 = new GeometricParallel(trapezoid.median, trapezoid.oppBaseSegment); GeometricParallel newParallel2 = new GeometricParallel(trapezoid.median, trapezoid.baseSegment); // For hypergraph List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(original); newGrounded.Add(new EdgeAggregator(antecedent, newParallel1, annotation)); newGrounded.Add(new EdgeAggregator(antecedent, newParallel2, annotation)); return(newGrounded); }
/// <summary> /// Figure out what possible segment combinations are before showing the window. /// </summary> protected override void OnShow() { options = new Dictionary <GeometryTutorLib.ConcreteAST.Segment, List <GeometryTutorLib.ConcreteAST.Segment> >(); //Get a list of all congruent segment givens List <GroundedClause> psegs = new List <GroundedClause>(); foreach (GroundedClause gc in currentGivens) { GeometricParallel pseg = gc as GeometricParallel; if (pseg != null) { psegs.Add(pseg); } } //Pick a first segment... foreach (GeometryTutorLib.ConcreteAST.Segment ts1 in parser.backendParser.implied.segments) { List <GeometryTutorLib.ConcreteAST.Segment> possible = new List <GeometryTutorLib.ConcreteAST.Segment>(); GeometryTutorLib.ConcreteAST.Segment s1 = new GeometryTutorLib.ConcreteAST.Segment(ts1.Point1, ts1.Point2); //... and see what other segments are viable second options. foreach (GeometryTutorLib.ConcreteAST.Segment ts2 in parser.backendParser.implied.segments) { GeometryTutorLib.ConcreteAST.Segment s2 = new GeometryTutorLib.ConcreteAST.Segment(ts2.Point1, ts2.Point2); if (s1.IsParallelWith(s2)) { GeometricParallel pseg = new GeometricParallel(s1, s2); if (!s1.StructurallyEquals(s2) && !StructurallyContains(psegs, pseg)) { possible.Add(s2); } } } //If we found a possible list of combinations, add it to the dictionary if (possible.Count > 0) { options.Add(s1, possible); } } //Set the options of the segment1 combo box segment1.ItemsSource = null; //Graphical refresh segment1.ItemsSource = options.Keys; }
private static List <EdgeAggregator> InstantiateFromTrapezoid(Trapezoid trapezoid, GroundedClause original) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // // Determine the parallel opposing sides and output that. // GeometricParallel newParallel = new GeometricParallel(trapezoid.baseSegment, trapezoid.oppBaseSegment); // For hypergraph List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(original); newGrounded.Add(new EdgeAggregator(antecedent, newParallel, annotation)); return(newGrounded); }
private static List <EdgeAggregator> CheckAndGenerateCorrespondingAnglesImplyParallel(Intersection inter1, Intersection inter2, CongruentAngles conAngles) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // The two intersections should not be at the same vertex if (inter1.intersect.Equals(inter2.intersect)) { return(newGrounded); } Segment transversal = inter1.CommonSegment(inter2); if (transversal == null) { return(newGrounded); } Angle angleI = inter1.GetInducedNonStraightAngle(conAngles); Angle angleJ = inter2.GetInducedNonStraightAngle(conAngles); // // Do we have valid intersections and congruent angle pairs // if (angleI == null || angleJ == null) { return(newGrounded); } // // Check to see if they are, in fact, Corresponding Angles // Segment parallelCand1 = inter1.OtherSegment(transversal); Segment parallelCand2 = inter2.OtherSegment(transversal); // The resultant candidate parallel segments shouldn't share any vertices if (parallelCand1.SharedVertex(parallelCand2) != null) { return(newGrounded); } // Numeric hack to discount any non-parallel segments if (!parallelCand1.IsParallelWith(parallelCand2)) { return(newGrounded); } // A sanity check that the '4th' point does not lie on the other intersection (thus creating an obvious triangle and thus not parallel lines) Point fourthPoint1 = parallelCand1.OtherPoint(inter1.intersect); Point fourthPoint2 = parallelCand2.OtherPoint(inter2.intersect); if (fourthPoint1 != null && fourthPoint2 != null) { if (parallelCand1.PointLiesOn(fourthPoint2) || parallelCand2.PointLiesOn(fourthPoint1)) { return(newGrounded); } } // Both angles should NOT be in the interioir OR the exterioir; a combination is needed. bool ang1Interior = angleI.OnInteriorOf(inter1, inter2); bool ang2Interior = angleJ.OnInteriorOf(inter1, inter2); if (ang1Interior && ang2Interior) { return(newGrounded); } if (!ang1Interior && !ang2Interior) { return(newGrounded); } // // Are these angles on the same side of the transversal? // // // Make a simple transversal from the two intersection points Segment simpleTransversal = new Segment(inter1.intersect, inter2.intersect); // Find the rays the lie on the transversal Segment rayNotOnTransversalI = angleI.OtherRayEquates(simpleTransversal); Segment rayNotOnTransversalJ = angleJ.OtherRayEquates(simpleTransversal); Point pointNotOnTransversalNorVertexI = rayNotOnTransversalI.OtherPoint(angleI.GetVertex()); Point pointNotOnTransversalNorVertexJ = rayNotOnTransversalJ.OtherPoint(angleJ.GetVertex()); // Create a segment from these two points so we can compare distances Segment crossing = new Segment(pointNotOnTransversalNorVertexI, pointNotOnTransversalNorVertexJ); // // Will this crossing segment actually intersect the real transversal in the middle of the two segments It should NOT. // Point intersection = transversal.FindIntersection(crossing); if (Segment.Between(intersection, inter1.intersect, inter2.intersect)) { return(newGrounded); } // // Now we have an alternate interior scenario // GeometricParallel newParallel = new GeometricParallel(parallelCand1, parallelCand2); // Construct hyperedge List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(inter1); antecedent.Add(inter2); antecedent.Add(conAngles); newGrounded.Add(new EdgeAggregator(antecedent, newParallel, annotation)); return(newGrounded); }
private static List <EdgeAggregator> CheckAndGenerateSameSideInteriorImplyParallel(Intersection inter1, Intersection inter2, Supplementary supp) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // Get the transversal (shared segment), if it exists Segment transversal = inter1.AcquireTransversal(inter2); if (transversal == null) { return(newGrounded); } Angle angleI = inter1.GetInducedNonStraightAngle(supp); Angle angleJ = inter2.GetInducedNonStraightAngle(supp); // // Do we have valid intersections and congruent angle pairs // if (angleI == null || angleJ == null) { return(newGrounded); } // // Check to see if they are, in fact, alternate interior angles respectively // // Are the angles within the interior Segment parallelCand1 = inter1.OtherSegment(transversal); Segment parallelCand2 = inter2.OtherSegment(transversal); if (!angleI.OnInteriorOf(inter1, inter2) || !angleJ.OnInteriorOf(inter1, inter2)) { return(newGrounded); } // // Are these angles on the opposite side of the transversal? // // Make a simple transversal from the two intersection points Segment simpleTransversal = new Segment(inter1.intersect, inter2.intersect); // Find the rays the lie on the transversal Segment rayNotOnTransversalI = angleI.OtherRayEquates(simpleTransversal); Segment rayNotOnTransversalJ = angleJ.OtherRayEquates(simpleTransversal); Point pointNotOnTransversalNorVertexI = rayNotOnTransversalI.OtherPoint(angleI.GetVertex()); Point pointNotOnTransversalNorVertexJ = rayNotOnTransversalJ.OtherPoint(angleJ.GetVertex()); // Create a segment from these two points so we can compare distances Segment crossing = new Segment(pointNotOnTransversalNorVertexI, pointNotOnTransversalNorVertexJ); // // Will this crossing segment intersect the real transversal in the middle of the two segments? If it DOES NOT, it is same side // Point intersection = transversal.FindIntersection(crossing); if (Segment.Between(intersection, inter1.intersect, inter2.intersect)) { return(newGrounded); } // // Now we have an alternate interior scenario // GeometricParallel newParallel = new GeometricParallel(parallelCand1, parallelCand2); // Construct hyperedge List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(inter1); antecedent.Add(inter2); antecedent.Add(supp); newGrounded.Add(new EdgeAggregator(antecedent, newParallel, annotation)); return(newGrounded); }