/// <summary> /// Figure out which angles we can choose from before the window is shown. /// </summary> protected override void OnShow() { List <GroundedClause> givens = new List <GroundedClause>(); //Populate list with applicable givens foreach (GroundedClause gc in currentGivens) { GeometryTutorLib.ConcreteAST.SegmentBisector sb = gc as GeometryTutorLib.ConcreteAST.SegmentBisector; if (sb != null) { givens.Add(sb); } } var bisectors = new List <GeometryTutorLib.ConcreteAST.SegmentBisector>(); //Populate list with possible choices foreach (GeometryTutorLib.ConcreteAST.SegmentBisector sb in parser.backendParser.implied.segmentBisectors) { if (!StructurallyContains(givens, sb)) { bisectors.Add(sb); } } options.ItemsSource = null; //Makes sure the box is graphically updated. options.ItemsSource = bisectors; }
public override bool Equals(Object obj) { SegmentBisector b = obj as SegmentBisector; if (b == null) { return(false); } return(bisector.Equals(b.bisector) && bisected.Equals(b.bisected) && base.Equals(obj)); }
// SegmentBisector has a specific order associated with the intersection segments. public override bool StructurallyEquals(Object obj) { SegmentBisector b = obj as SegmentBisector; if (b == null) { return(false); } // The bisector segment if (!bisector.StructurallyEquals(b.bisector)) { return(false); } // The intersection points if (!bisected.intersect.StructurallyEquals(b.bisected.intersect)) { return(false); } // The bisected segments return(bisected.OtherSegment(bisector).StructurallyEquals(b.bisected.OtherSegment(b.bisector))); }
// // Take the angle congruence and bisector and create the AngleBisector relation // private static List<EdgeAggregator> InstantiateToMedian(Triangle tri, SegmentBisector sb, GroundedClause original) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // The Bisector cannot be a side of the triangle. if (tri.CoincidesWithASide(sb.bisector) != null) return newGrounded; // Acquire the intersection segment that coincides with the base of the triangle Segment triangleBaseCandidate = sb.bisected.OtherSegment(sb.bisector); Segment triangleBase = tri.CoincidesWithASide(triangleBaseCandidate); if (triangleBase == null) return newGrounded; // The candidate base and the actual triangle side must equate exactly if (!triangleBase.HasSubSegment(triangleBaseCandidate) || !triangleBaseCandidate.HasSubSegment(triangleBase)) return newGrounded; // The point opposite the base of the triangle must be within the endpoints of the bisector Point oppPoint = tri.OtherPoint(triangleBase); if (!sb.bisector.PointLiesOnAndBetweenEndpoints(oppPoint)) return newGrounded; // -> Median(Segment(V, C), Triangle(A, B, C)) Median newMedian = new Median(sb.bisector, tri); // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(tri); antecedent.Add(original); newGrounded.Add(new EdgeAggregator(antecedent, newMedian, annotation)); return newGrounded; }
// A _________________ B // / / // / \/ / // / /\ / // D /________________/ C // // Quadrilateral(A, B, C, D), SegmentBisector(Segment(A, C), Segment(B, D)), // SegmentBisector(Segment(B, D), Segment(A, C)) -> Parallelogram(A, B, C, D) // private static List<EdgeAggregator> InstantiateToTheorem(Quadrilateral quad, SegmentBisector sb1, SegmentBisector sb2, GroundedClause originalSB1, GroundedClause originalSB2) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // The two segment bisectors must intersect at the same point if (!sb1.bisected.intersect.StructurallyEquals(sb2.bisected.intersect)) return newGrounded; // The bisectors must be part of the other segment bisector. if (!sb1.bisected.HasSegment(sb2.bisector)) return newGrounded; if (!sb2.bisected.HasSegment(sb1.bisector)) return newGrounded; // Do these segment bisectors define the diagonals of the quadrilateral? if (!sb1.bisector.HasSubSegment(quad.topLeftBottomRightDiagonal) && !sb2.bisector.HasSubSegment(quad.topLeftBottomRightDiagonal)) return newGrounded; if (!sb1.bisector.HasSubSegment(quad.bottomLeftTopRightDiagonal) && !sb2.bisector.HasSubSegment(quad.bottomLeftTopRightDiagonal)) return newGrounded; // Determine the CongruentSegments opposing sides and output that. Strengthened newParallelogram = new Strengthened(quad, new Parallelogram(quad)); // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(quad); antecedent.Add(originalSB1); antecedent.Add(originalSB2); newGrounded.Add(new EdgeAggregator(antecedent, newParallelogram, annotation)); return newGrounded; }
// // Take the angle congruence and bisector and create the AngleBisector relation // \ // \ // B ---------V---------A // \ // \ // C // private static List<EdgeAggregator> InstantiateToDef(Point intersectionPoint, Intersection inter, CongruentSegments cs) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // Does the given point of intersection apply to this actual intersection object if (!intersectionPoint.Equals(inter.intersect)) return newGrounded; // The entire segment AB Segment overallSegment = new Segment(cs.cs1.OtherPoint(intersectionPoint), cs.cs2.OtherPoint(intersectionPoint)); // The segment must align completely with one of the intersection segments Segment interCollinearSegment = inter.GetCollinearSegment(overallSegment); if (interCollinearSegment == null) return newGrounded; // Does this intersection have the entire segment AB if (!inter.HasSegment(overallSegment)) return newGrounded; Segment bisector = inter.OtherSegment(overallSegment); Segment bisectedSegment = inter.GetCollinearSegment(overallSegment); // Check if the bisected segment extends is the exact same segment as the overall segment AB if (!bisectedSegment.StructurallyEquals(overallSegment)) { if (overallSegment.PointLiesOnAndBetweenEndpoints(bisectedSegment.Point1) && overallSegment.PointLiesOnAndBetweenEndpoints(bisectedSegment.Point2)) return newGrounded; } SegmentBisector newSB = new SegmentBisector(inter, bisector); // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(inter); antecedent.Add(cs); newGrounded.Add(new EdgeAggregator(antecedent, newSB, annotation)); return newGrounded; }
public static List<EdgeAggregator> InstantiateFromSegmentBisector(InMiddle im, SegmentBisector sb, GroundedClause original) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // Does this bisector apply to this InMiddle? Check point of intersection if (!im.point.StructurallyEquals(sb.bisected.intersect)) return newGrounded; // Segments must equate if (!im.segment.StructurallyEquals(sb.bisected.OtherSegment(sb.bisector))) return newGrounded; // Create the midpoint Strengthened newMidpoint = new Strengthened(im, new Midpoint(im)); // For hypergraph List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(original); antecedent.Add(im); newGrounded.Add(new EdgeAggregator(antecedent, newMidpoint, annotation)); return newGrounded; }