public override bool Equals(Object obj) { CircleSegmentIntersection inter = obj as CircleSegmentIntersection; if (inter == null) { return(false); } return(this.segment.Equals(inter.segment) && this.intersect.StructurallyEquals(inter.intersect) && this.theCircle.StructurallyEquals(inter.theCircle)); }
public Page10Prob36(bool onoff, bool complete) : base(onoff, complete) { Point a = new Point("A", 0, 0); points.Add(a); Point b = new Point("B", 0, 9); points.Add(b); Point c = new Point("C", 8, 9); points.Add(c); Point d = new Point("D", 12, 9); points.Add(d); Point e = new Point("E", 12, 0); points.Add(e); Segment ab = new Segment(a, b); segments.Add(ab); Segment cd = new Segment(c, d); segments.Add(cd); Segment de = new Segment(d, e); segments.Add(de); Segment ea = new Segment(e, a); segments.Add(ea); Point x = new Point("X", 4, 9.0); points.Add(x); circles.Add(new Circle(x, 4.0)); List<Point> pts = new List<Point>(); pts.Add(b); pts.Add(x); pts.Add(c); pts.Add(d); collinear.Add(new Collinear(pts)); parser = new TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff); CircleSegmentIntersection csi = new CircleSegmentIntersection(b, circles[0], ab); given.Add(new Tangent((CircleSegmentIntersection)parser.Get(csi))); given.Add(new RightAngle((Angle)parser.Get(new Angle(b, a, e)))); given.Add(new GeometricCongruentSegments((Segment)parser.Get(new Segment(b, d)), ea)); known.AddSegmentLength(ab, 9); known.AddSegmentLength(cd, 4); known.AddSegmentLength(ea, 12); List<Point> wanted = new List<Point>(); wanted.Add(new Point("", 10, 1)); goalRegions = parser.implied.GetAtomicRegionsByPoints(wanted); SetSolutionArea(108 - 16 * System.Math.PI / 2.0); problemName = "Glencoe Page 10 Problem 36"; GeometryTutorLib.EngineUIBridge.HardCodedProblemsToUI.AddProblem(problemName, points, circles, segments); }
// ) | B // ) | // O )| S // ) | // ) | // ) | A // Tangent(Circle(O, R), Segment(A, B)), Intersection(OS, AB) -> Perpendicular(Segment(A,B), Segment(O, S)) // private static List<EdgeAggregator> InstantiateTheorem(CircleSegmentIntersection inter, Perpendicular perp, GroundedClause original) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // The intersection points must be the same. if (!inter.intersect.StructurallyEquals(perp.intersect)) return newGrounded; // Get the radius - if it exists Segment radius = null; Segment garbage = null; inter.GetRadii(out radius, out garbage); if (radius == null) return newGrounded; // Two intersections, not a tangent situation. if (garbage != null) return newGrounded; // The radius can't be the same as the Circ-Inter segment. if (inter.segment.HasSubSegment(radius)) return newGrounded; // Does this perpendicular apply to this Arc intersection? if (!perp.HasSegment(radius) || !perp.HasSegment(inter.segment)) return newGrounded; Strengthened newTangent = new Strengthened(inter, new Tangent(inter)); // For hypergraph List<GroundedClause> antecedent = new List<GroundedClause>(); antecedent.Add(original); antecedent.Add(inter); newGrounded.Add(new EdgeAggregator(antecedent, newTangent, annotation)); return newGrounded; }
public ArcSegmentBisector(CircleSegmentIntersection b) : base() { bisected = b; }
// A // |) // | ) // | ) // Q------- O---X---) D // | ) // | ) // |) // C // // Perpendicular(Segment(Q, D), Segment(A, C)) -> Congruent(Arc(A, D), Arc(D, C)) -> Congruent(Segment(AX), Segment(XC)) // private static List<EdgeAggregator> InstantiateTheorem(Intersection inter, CircleSegmentIntersection arcInter, Perpendicular perp, GroundedClause original) { List<EdgeAggregator> newGrounded = new List<EdgeAggregator>(); // // Does this intersection apply to this perpendicular? // if (!inter.intersect.StructurallyEquals(perp.intersect)) return newGrounded; // Is this too restrictive? if (!((inter.HasSegment(perp.lhs) && inter.HasSegment(perp.rhs)) && (perp.HasSegment(inter.lhs) && perp.HasSegment(inter.rhs)))) return newGrounded; // // Does this perpendicular intersection apply to a given circle? // // Acquire the circles for which the segments are secants. List<Circle> secantCircles1 = Circle.GetSecantCircles(perp.lhs); List<Circle> secantCircles2 = Circle.GetSecantCircles(perp.rhs); List<Circle> intersection = Utilities.Intersection<Circle>(secantCircles1, secantCircles2); if (!intersection.Any()) return newGrounded; // // Find the single, unique circle that has as chords the components of the perpendicular intersection // Circle theCircle = null; Segment chord1 = null; Segment chord2 = null; foreach (Circle circle in intersection) { chord1 = circle.GetChord(perp.lhs); chord2 = circle.GetChord(perp.rhs); if (chord1 != null && chord2 != null) { theCircle = circle; break; } } Segment diameter = chord1.Length > chord2.Length ? chord1 : chord2; Segment chord = chord1.Length < chord2.Length ? chord1 : chord2; // // Does the arc intersection apply? // if (!arcInter.HasSegment(diameter)) return newGrounded; if (!theCircle.StructurallyEquals(arcInter.theCircle)) return newGrounded; // // Create the bisector // Strengthened sb = new Strengthened(inter, new SegmentBisector(inter, diameter)); Strengthened ab = new Strengthened(arcInter, new ArcSegmentBisector(arcInter)); // For hypergraph List<GroundedClause> antecedentArc = new List<GroundedClause>(); antecedentArc.Add(arcInter); antecedentArc.Add(original); antecedentArc.Add(theCircle); newGrounded.Add(new EdgeAggregator(antecedentArc, ab, annotation)); List<GroundedClause> antecedentSegment = new List<GroundedClause>(); antecedentSegment.Add(inter); antecedentSegment.Add(original); antecedentSegment.Add(theCircle); newGrounded.Add(new EdgeAggregator(antecedentSegment, sb, annotation)); return newGrounded; }
// // Find every point of intersection among segments (if they are not labeled in the UI) -- name them. // public List<CircleSegmentIntersection> FindCircleSegmentIntersections() { List<CircleSegmentIntersection> intersections = new List<CircleSegmentIntersection>(); foreach (GeometryTutorLib.ConcreteAST.Circle circle in implied.circles) { foreach (GeometryTutorLib.ConcreteAST.Segment segment in implied.segments) { Point inter1 = null; Point inter2 = null; circle.FindIntersection(segment, out inter1, out inter2); if (!segment.PointLiesOnAndBetweenEndpoints(inter1)) inter1 = null; if (!segment.PointLiesOnAndBetweenEndpoints(inter2)) inter2 = null; // Analyze this segment w.r.t. to this circle: tangent, secant, chord. if (inter1 != null || inter2 != null) { circle.AnalyzeSegment(segment, implied.allFigurePoints); } } } foreach (GeometryTutorLib.ConcreteAST.Circle circle in implied.circles) { foreach (GeometryTutorLib.ConcreteAST.Segment segment in implied.maximalSegments) { // // Find any intersection points between the circle and the segment; // the intersection MUST be between the segment endpoints // Point inter1 = null; Point inter2 = null; circle.FindIntersection(segment, out inter1, out inter2); if (!segment.PointLiesOnAndBetweenEndpoints(inter1)) inter1 = null; if (!segment.PointLiesOnAndBetweenEndpoints(inter2)) inter2 = null; // Add them to the list (possibly) List<Point> intersectionPts = new List<Point>(); if (inter1 != null) intersectionPts.Add(inter1); if (inter2 != null) intersectionPts.Add(inter2); // normalized to drawing point (names) intersectionPts = implied.NormalizePointsToDrawing(intersectionPts); // and add to each figure (circle and polygon). circle.AddIntersectingPoints(intersectionPts); // // Construct the intersections // CircleSegmentIntersection csInter = null; if (intersectionPts.Any()) { csInter = new CircleSegmentIntersection(intersectionPts[0], circle, segment); GeometryTutorLib.Utilities.AddStructurallyUnique<CircleSegmentIntersection>(intersections, csInter); } if (intersectionPts.Count > 1) { csInter = new CircleSegmentIntersection(intersectionPts[1], circle, segment); GeometryTutorLib.Utilities.AddStructurallyUnique<CircleSegmentIntersection>(intersections, csInter); } } // Complete any processing attributed to the circle and all the segments. circle.CleanUp(); } return intersections; }