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); }
public static List <EdgeAggregator> Instantiate(GroundedClause c) { annotation.active = EngineUIBridge.JustificationSwitch.SEGMENT_ADDITION_AXIOM; List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); InMiddle im = c as InMiddle; if (im == null) { return(newGrounded); } Segment s1 = new Segment(im.segment.Point1, im.point); Segment s2 = new Segment(im.point, im.segment.Point2); Addition sum = new Addition(s1, s2); GeometricSegmentEquation eq = new GeometricSegmentEquation(sum, im.segment); eq.MakeAxiomatic(); // For hypergraph List <GroundedClause> antecedent = Utilities.MakeList <GroundedClause>(im); newGrounded.Add(new EdgeAggregator(antecedent, eq, annotation)); return(newGrounded); }
// B ---------V---------A // \ // \ // \ // C // // Median(Segment(V, C), Triangle(C, A, B)) -> Midpoint(V, Segment(B, A)) // private static List <EdgeAggregator> InstantiateFromMedian(GroundedClause clause) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); if (clause is InMiddle && !(clause is Midpoint)) { InMiddle im = clause as InMiddle; foreach (Median median in candidateMedian) { newGrounded.AddRange(InstantiateFromMedian(im, median)); } candidateInMiddle.Add(im); } else if (clause is Median) { Median median = clause as Median; foreach (InMiddle im in candidateInMiddle) { newGrounded.AddRange(InstantiateFromMedian(im, median)); } candidateMedian.Add(median); } return(newGrounded); }
// // Congruent(Segment(A, M), Segment(M, B)) -> Midpoint(M, Segment(A, B)) // private static List <EdgeAggregator> InstantiateToMidpoint(InMiddle im, CongruentSegments css) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); Point midpoint = css.cs1.SharedVertex(css.cs2); // Does this InMiddle relate to the congruent segments? if (!im.point.StructurallyEquals(midpoint)) { return(newGrounded); } // Do the congruent segments combine into a single segment equating to the InMiddle? Segment overallSegment = new Segment(css.cs1.OtherPoint(midpoint), css.cs2.OtherPoint(midpoint)); if (!im.segment.StructurallyEquals(overallSegment)) { return(newGrounded); } Strengthened newMidpoint = new Strengthened(im, new Midpoint(im)); // For hypergraph List <GroundedClause> antecedent = new List <GroundedClause>(); antecedent.Add(im); antecedent.Add(css); newGrounded.Add(new EdgeAggregator(antecedent, newMidpoint, annotation)); return(newGrounded); }
private static List <EdgeAggregator> InstantiateFromMidpoint(InMiddle im, Midpoint midpt, GroundedClause original) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // Does this ImMiddle apply to this midpoint? if (!im.point.StructurallyEquals(midpt.point)) { return(newGrounded); } if (!im.segment.StructurallyEquals(midpt.segment)) { return(newGrounded); } // For hypergraph List <GroundedClause> antecedent = Utilities.MakeList <GroundedClause>(original); // Backward: Midpoint(M, Segment(A, B)) -> InMiddle(A, M, B) newGrounded.Add(new EdgeAggregator(antecedent, im, annotation)); // // Forward: Midpoint(M, Segment(A, B)) -> Congruent(Segment(A,M), Segment(M,B)) // Segment left = new Segment(midpt.segment.Point1, midpt.point); Segment right = new Segment(midpt.point, midpt.segment.Point2); GeometricCongruentSegments ccss = new GeometricCongruentSegments(left, right); newGrounded.Add(new EdgeAggregator(antecedent, ccss, annotation)); return(newGrounded); }
public MgProb2(bool onoff, bool complete) : base(onoff, complete) { double r = 2 * System.Math.Sqrt(3); Point a = new Point("A", 0, 0); points.Add(a); Point b = new Point("B", 4, 2 * r); points.Add(b); Point c = new Point("C", 8, 0); points.Add(c); Point d = new Point("D", 4, 0); points.Add(d); Point e = new Point("E", 4, r); points.Add(e); Segment ab = new Segment(a, b); segments.Add(ab); Segment bc = new Segment(b, c); segments.Add(bc); List <Point> pnts = new List <Point>(); pnts.Add(a); pnts.Add(d); pnts.Add(c); collinear.Add(new Collinear(pnts)); pnts = new List <Point>(); pnts.Add(b); pnts.Add(e); pnts.Add(d); collinear.Add(new Collinear(pnts)); Circle circle = new Circle(e, r); circles.Add(circle); parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff); Segment ad = (Segment)parser.Get(new Segment(a, d)); InMiddle mid = (InMiddle)parser.Get(new InMiddle(d, (Segment)parser.Get(new Segment(a, c)))); Angle a1 = (Angle)parser.Get(new Angle(a, d, b)); Triangle tri = (Triangle)parser.Get(new Triangle(a, b, c)); given.Add(new Strengthened(a1, new RightAngle(a1))); given.Add(new Strengthened(tri, new EquilateralTriangle(tri))); given.Add(new Strengthened(mid, new Midpoint(mid))); known.AddSegmentLength(ad, 4); List <Point> unwanted = new List <Point>(); unwanted.Add(new Point("", 0.1, 0.1)); unwanted.Add(new Point("", 7.9, 0.1)); goalRegions = parser.implied.GetAllAtomicRegionsWithoutPoints(unwanted); SetSolutionArea(r * r * System.Math.PI); problemName = "Magoosh Problem 2"; GeometryTutorLib.EngineUIBridge.HardCodedProblemsToUI.AddProblem(problemName, points, circles, segments); }
public Page146Problem15(bool onoff, bool complete) : base(onoff, complete) { problemName = "Page 146 Problem 15"; Point t = new Point("T", 0, 0); points.Add(t); Point p = new Point("P", 0.5, 1.5); points.Add(p); Point s = new Point("S", 1, 3); points.Add(s); Point x = new Point("X", 3, 1); points.Add(x); Point q = new Point("Q", 3.5, 2.5); points.Add(q); Point y = new Point("Y", 4, 4); points.Add(y); Point o = new Point("O", 2, 2); points.Add(o); List <Point> pts = new List <Point>(); pts.Add(t); pts.Add(o); pts.Add(y); collinear.Add(new Collinear(pts)); pts = new List <Point>(); pts.Add(s); pts.Add(o); pts.Add(x); collinear.Add(new Collinear(pts)); pts = new List <Point>(); pts.Add(s); pts.Add(p); pts.Add(t); collinear.Add(new Collinear(pts)); pts = new List <Point>(); pts.Add(y); pts.Add(q); pts.Add(x); collinear.Add(new Collinear(pts)); pts = new List <Point>(); pts.Add(p); pts.Add(o); pts.Add(q); collinear.Add(new Collinear(pts)); parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff); given.Add(new SegmentBisector(parser.GetIntersection(new Segment(s, x), new Segment(t, y)), (Segment)parser.Get(new Segment(s, x)))); given.Add(new SegmentBisector(parser.GetIntersection(new Segment(s, x), new Segment(t, y)), (Segment)parser.Get(new Segment(t, y)))); InMiddle goalIm = (InMiddle)parser.Get(new InMiddle(o, new Segment(p, q))); goals.Add(new Strengthened(goalIm, new Midpoint(goalIm))); }
// // Midpoint(M, Segment(A, B)) -> InMiddle(A, M, B) // Midpoint(M, Segment(A, B)) -> Congruent(Segment(A,M), Segment(M,B)); This implies: AM = MB // private static List <EdgeAggregator> InstantiateFromMidpoint(GroundedClause clause) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); if (clause is InMiddle && !(clause is Midpoint)) { InMiddle inMid = clause as InMiddle; foreach (Midpoint midpt in candidateMidpoint) { newGrounded.AddRange(InstantiateFromMidpoint(inMid, midpt, midpt)); } foreach (Strengthened streng in candidateStrengthened) { newGrounded.AddRange(InstantiateFromMidpoint(inMid, streng.strengthened as Midpoint, streng)); } candidateInMiddle.Add(inMid); } else if (clause is Midpoint) { Midpoint midpt = clause as Midpoint; foreach (InMiddle im in candidateInMiddle) { newGrounded.AddRange(InstantiateFromMidpoint(im, midpt, midpt)); } candidateMidpoint.Add(midpt); } else if (clause is Strengthened) { Strengthened streng = clause as Strengthened; if (!(streng.strengthened is Midpoint)) { return(newGrounded); } foreach (InMiddle im in candidateInMiddle) { newGrounded.AddRange(InstantiateFromMidpoint(im, streng.strengthened as Midpoint, streng)); } candidateStrengthened.Add(streng); } return(newGrounded); }
// B ---------V---------A // \ // \ // \ // C // // SegmentBisector(Segment(V, C), Segment(B, A)) -> Midpoint(V, Segment(B, A)) // public static List <EdgeAggregator> InstantiateFromSegmentBisector(GroundedClause clause) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); if (clause is SegmentBisector) { SegmentBisector sb = clause as SegmentBisector; foreach (InMiddle im in candidateInMiddle) { newGrounded.AddRange(InstantiateFromSegmentBisector(im, sb, sb)); } candidateSegmentBisector.Add(sb); } else if (clause is Strengthened) { Strengthened streng = clause as Strengthened; if (!(streng.strengthened is SegmentBisector)) { return(newGrounded); } foreach (InMiddle im in candidateInMiddle) { newGrounded.AddRange(InstantiateFromSegmentBisector(im, streng.strengthened as SegmentBisector, streng)); } candidateStrengthened.Add(streng); } else if (clause is InMiddle) { InMiddle newIm = clause as InMiddle; foreach (SegmentBisector sb in candidateSegmentBisector) { newGrounded.AddRange(InstantiateFromSegmentBisector(newIm, sb, sb)); } foreach (Strengthened streng in candidateStrengthened) { newGrounded.AddRange(InstantiateFromSegmentBisector(newIm, streng.strengthened as SegmentBisector, streng)); } candidateInMiddle.Add(newIm); } return(newGrounded); }
private static List <EdgeAggregator> InstantiateToMidpoint(GroundedClause clause) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); if (clause is InMiddle && !(clause is Midpoint)) { InMiddle inMid = clause as InMiddle; foreach (CongruentSegments css in candidateCongruent) { newGrounded.AddRange(InstantiateToMidpoint(inMid, css)); } // No need to add this InMiddle object to the list since it was added previously in InstantiateFrom } else if (clause is CongruentSegments) { CongruentSegments css = clause as CongruentSegments; // A reflexive relationship cannot possibly create a midpoint situation if (css.IsReflexive()) { return(newGrounded); } // The congruence must relate two collinear segments... if (!css.cs1.IsCollinearWith(css.cs2)) { return(newGrounded); } // ...that share a vertex if (css.cs1.SharedVertex(css.cs2) == null) { return(newGrounded); } foreach (InMiddle im in candidateInMiddle) { newGrounded.AddRange(InstantiateToMidpoint(im, css)); } candidateCongruent.Add(css); } return(newGrounded); }
private static List <EdgeAggregator> InstantiateFromMedian(InMiddle im, Median median) { List <EdgeAggregator> newGrounded = new List <EdgeAggregator>(); // Which point is on the side of the triangle? Point vertexOnTriangle = median.theTriangle.GetVertexOn(median.medianSegment); Segment segmentCutByMedian = median.theTriangle.GetOppositeSide(vertexOnTriangle); Point midpt = segmentCutByMedian.FindIntersection(median.medianSegment); // This is to acquire the name of the midpoint, nothing more. if (midpt.Equals(median.medianSegment.Point1)) { midpt = median.medianSegment.Point1; } else if (midpt.Equals(median.medianSegment.Point2)) { midpt = median.medianSegment.Point2; } // Does this median apply to this InMiddle? Point check ... if (!im.point.StructurallyEquals(midpt)) { return(newGrounded); } // Segment check if (!im.segment.StructurallyEquals(segmentCutByMedian)) { return(newGrounded); } // Create the midpoint Strengthened newMidpoint = new Strengthened(im, new Midpoint(im)); // For hypergraph List <GroundedClause> antecedent = Utilities.MakeList <GroundedClause>(median); antecedent.Add(im); newGrounded.Add(new EdgeAggregator(antecedent, newMidpoint, annotation)); return(newGrounded); }