示例#1
0
        //Demonstrates: congruent chords have congruent arcs

        public Page306Theorem7_4_1(bool onoff, bool complete) : base(onoff, complete)
        {
            Point o = new Point("O", 0, 0); points.Add(o);
            Point r = new Point("R", -3, 4); points.Add(r);
            Point s = new Point("S", 2, Math.Sqrt(21)); points.Add(s);
            Point t = new Point("T", 2, -Math.Sqrt(21)); points.Add(t);
            Point u = new Point("U", -3, -4); points.Add(u);

            Segment rt = new Segment(r, t);
            Segment su = new Segment(s, u);
            Point   v  = rt.FindIntersection(su); points.Add(v);

            Segment rs = new Segment(r, s); segments.Add(rs);
            Segment ut = new Segment(u, t); segments.Add(ut);

            Circle c = new Circle(o, 5.0);

            circles.Add(c);

            parser = new GeometryTutorLib.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);

            given.Add(new GeometricCongruentSegments(rs, ut));

            MinorArc a1  = (MinorArc)parser.Get(new MinorArc(c, r, s));
            MinorArc a2  = (MinorArc)parser.Get(new MinorArc(c, t, u));
            MajorArc ma1 = (MajorArc)parser.Get(new MajorArc(c, r, s));
            MajorArc ma2 = (MajorArc)parser.Get(new MajorArc(c, t, u));

            goals.Add(new GeometricCongruentArcs(a1, a2));
            goals.Add(new GeometricCongruentArcs(ma1, ma2));
        }
        //
        //    A \ 
        //       \    B
        //        \  /
        //  O      \/ X
        //         /\
        //        /  \
        //     C /    D
        //
        // Two tangents:
        // Intersection(X, AD, BC), Tangent(Circle(O), BC), Tangent(Circle(O), AD) -> 2 * Angle(AXC) = MajorArc(AC) - MinorArc(AC)
        //
        public static List <EdgeAggregator> InstantiateTwoTangentsTheorem(Tangent tangent1, Tangent tangent2, Intersection inter, GroundedClause original1, GroundedClause original2)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            CircleSegmentIntersection tan1 = tangent1.intersection as CircleSegmentIntersection;
            CircleSegmentIntersection tan2 = tangent2.intersection as CircleSegmentIntersection;

            if (tan1.StructurallyEquals(tan2))
            {
                return(newGrounded);
            }

            // Do the tangents apply to the same circle?
            if (!tan1.theCircle.StructurallyEquals(tan2.theCircle))
            {
                return(newGrounded);
            }

            Circle circle = tan1.theCircle;

            // Do these tangents work with this intersection?
            if (!inter.HasSegment(tan1.segment) || !inter.HasSegment(tan2.segment))
            {
                return(newGrounded);
            }

            // Overkill? Do the tangents intersect at the same point as the intersection's intersect point?
            if (!tan1.segment.FindIntersection(tan2.segment).StructurallyEquals(inter.intersect))
            {
                return(newGrounded);
            }

            //
            // Get the arcs
            //
            Arc minorArc = new MinorArc(circle, tan1.intersect, tan2.intersect);
            Arc majorArc = new MajorArc(circle, tan1.intersect, tan2.intersect);

            Angle theAngle = new Angle(tan1.intersect, inter.intersect, tan2.intersect);

            //
            // Construct the new relationship
            //
            NumericValue two = new NumericValue(2);

            GeometricAngleArcEquation gaaeq = new GeometricAngleArcEquation(new Multiplication(two, theAngle), new Subtraction(majorArc, minorArc));

            // For hypergraph
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(original1);
            antecedent.Add(original2);
            antecedent.Add(inter);
            antecedent.Add(majorArc);
            antecedent.Add(minorArc);

            newGrounded.Add(new EdgeAggregator(antecedent, gaaeq, annotation));

            return(newGrounded);
        }
示例#3
0
        //
        // If one of the endpoints of that is inside of this; and vice versa.
        //
        public bool Overlap(Connection that)
        {
            if (that.type != this.type)
            {
                return(false);
            }

            if (this.type == ConnectionType.ARC)
            {
                if (!(this.segmentOrArc as Arc).StructurallyEquals(this.segmentOrArc as Arc))
                {
                    return(false);
                }

                // If the arcs just touch, it's not overlap.
                if (this.segmentOrArc is MinorArc)
                {
                    MinorArc minor = this.segmentOrArc as MinorArc;
                    if (minor.PointLiesStrictlyOn(that.endpoint1) || minor.PointLiesStrictlyOn(that.endpoint2))
                    {
                        return(true);
                    }
                }
                else if (this.segmentOrArc is Semicircle)
                {
                    Semicircle semi = this.segmentOrArc as Semicircle;
                    if (semi.PointLiesStrictlyOn(that.endpoint1) || semi.PointLiesStrictlyOn(that.endpoint2))
                    {
                        return(true);
                    }
                }
                else if (this.segmentOrArc is MajorArc)
                {
                    MajorArc major = this.segmentOrArc as MajorArc;
                    if (major.PointLiesStrictlyOn(that.endpoint1) || major.PointLiesStrictlyOn(that.endpoint2))
                    {
                        return(true);
                    }
                }
                return(false);
            }
            else if (this.type == ConnectionType.SEGMENT)
            {
                Segment thisSegment = this.segmentOrArc as Segment;
                Segment thatSegment = that.segmentOrArc as Segment;

                if (!thisSegment.IsCollinearWith(thatSegment))
                {
                    return(false);
                }

                return(thisSegment.CoincidingWithOverlap(thatSegment));
            }

            return(false);
        }
示例#4
0
        public static List <EdgeAggregator> Instantiate(GroundedClause c)
        {
            annotation.active = EngineUIBridge.JustificationSwitch.ARC_ADDITION_AXIOM;

            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();
            ArcInMiddle           im          = c as ArcInMiddle;

            if (im == null)
            {
                return(newGrounded);
            }

            Addition sum = null;

            // Temporarily assume that the two arcs formed by the intersection are both minor arcs
            MinorArc a1 = new MinorArc(im.arc.theCircle, im.arc.endpoint1, im.point);
            MinorArc a2 = new MinorArc(im.arc.theCircle, im.point, im.arc.endpoint2);

            // If the intersected arc is a minor arc, this will always be true.
            // If the intersected arc is a major arc, this might be true. Other case is one minor arc and one major arc.
            if (Arc.BetweenMajor(im.point, im.arc))
            {
                // Check if both arcs are genuinely minor arcs.
                // If the other endpoint falls in the new arc, then the major arc should be used instead
                if (Arc.BetweenMinor(im.arc.endpoint2, a1))
                {
                    MajorArc majorArc = new MajorArc(im.arc.theCircle, im.arc.endpoint1, im.point);
                    sum = new Addition(majorArc, a2);
                }
                else if (Arc.BetweenMinor(im.arc.endpoint1, a2))
                {
                    MajorArc majorArc = new MajorArc(im.arc.theCircle, im.point, im.arc.endpoint2);
                    sum = new Addition(a1, majorArc);
                }
            }

            if (sum == null)
            {
                sum = new Addition(a1, a2);
            }

            GeometricArcEquation eq = new GeometricArcEquation(sum, im.arc);

            eq.MakeAxiomatic();

            // For hypergraph
            List <GroundedClause> antecedent = Utilities.MakeList <GroundedClause>(im);

            newGrounded.Add(new EdgeAggregator(antecedent, eq, annotation));


            return(newGrounded);
        }
        private void CreateMajorMinorArcs(Circle circle, int p1, int p2)
        {
            List <Point> minorArcPoints;
            List <Point> majorArcPoints;

            PartitionArcPoints(circle, p1, p2, out minorArcPoints, out majorArcPoints);

            MinorArc newMinorArc    = new MinorArc(circle, circle.pointsOnCircle[p1], circle.pointsOnCircle[p2], minorArcPoints, majorArcPoints);
            MajorArc newMajorArc    = new MajorArc(circle, circle.pointsOnCircle[p1], circle.pointsOnCircle[p2], minorArcPoints, majorArcPoints);
            Sector   newMinorSector = new Sector(newMinorArc);
            Sector   newMajorSector = new Sector(newMajorArc);

            if (!GeometryTutorLib.Utilities.HasStructurally <MinorArc>(minorArcs, newMinorArc))
            {
                minorArcs.Add(newMinorArc);
                minorSectors.Add(newMinorSector);
                majorSectors.Add(newMajorSector);

                angles.Add(new Angle(circle.pointsOnCircle[p1], circle.center, circle.pointsOnCircle[p2]));
            }
            if (!GeometryTutorLib.Utilities.HasStructurally <MajorArc>(majorArcs, newMajorArc))
            {
                majorArcs.Add(newMajorArc);
                majorSectors.Add(newMajorSector);
            }

            circle.AddMinorArc(newMinorArc);
            circle.AddMajorArc(newMajorArc);
            circle.AddMinorSector(newMinorSector);
            circle.AddMajorSector(newMajorSector);

            // Generate ArcInMiddle clauses for minor arc and major arc
            for (int imIndex = 0; imIndex < newMinorArc.arcMinorPoints.Count; imIndex++)
            {
                GeometryTutorLib.Utilities.AddStructurallyUnique <ArcInMiddle>(arcInMiddle, new ArcInMiddle(newMinorArc.arcMinorPoints[imIndex], newMinorArc));
            }
            for (int imIndex = 0; imIndex < newMajorArc.arcMajorPoints.Count; imIndex++)
            {
                GeometryTutorLib.Utilities.AddStructurallyUnique <ArcInMiddle>(arcInMiddle, new ArcInMiddle(newMajorArc.arcMajorPoints[imIndex], newMajorArc));
            }
        }
示例#6
0
        //Demonstrates: ExteriorAngleHalfDifferenceInterceptedArcs : two tangents
        //Demonstrates: Tangents from point are congruent

        public Test05(bool onoff, bool complete)
            : base(onoff, complete)
        {
            //Circle
            Point  o       = new Point("O", 0, 0); points.Add(o);
            Circle circleO = new Circle(o, 5.0);

            circles.Add(circleO);

            //Intersection point for two tangents
            Point c = new Point("C", 0, 6.25); points.Add(c);

            //Points for tangent line ac, intersection at b
            Point a = new Point("A", -8, 0.25); points.Add(a);
            Point b = new Point("B", -3, 4); points.Add(b);

            //Points for tangent line ec, intersection at d
            Point e = new Point("E", 8, 0.25); points.Add(e);
            Point d = new Point("D", 3, 4); points.Add(d);

            //Create point for another arc (Arc(DF)) of equal measure to (1/2)*(MajorArc(BD)-MinorArc(BD))
            MinorArc minor   = new MinorArc(circleO, b, d);
            MajorArc major   = new MajorArc(circleO, b, d);
            double   measure = (major.GetMajorArcMeasureDegrees() - minor.GetMinorArcMeasureDegrees()) / 2;
            //Get theta for D and E
            Circle unit = new Circle(o, 1.0);
            Point  inter1, trash;

            unit.FindIntersection(new Segment(o, d), out inter1, out trash);
            if (inter1.X < 0)
            {
                inter1 = trash;
            }
            double dThetaDegrees = (System.Math.Acos(inter1.X)) * (180 / System.Math.PI);
            double fThetaRadians = (dThetaDegrees - measure) * (System.Math.PI / 180);
            //Get coordinates for E
            Point unitPnt = new Point("", System.Math.Cos(fThetaRadians), System.Math.Sin(fThetaRadians));
            Point f;

            circleO.FindIntersection(new Segment(o, unitPnt), out f, out trash);
            if (f.X < 0)
            {
                f = trash;
            }
            f = new Point("F", f.X, f.Y); points.Add(f);

            //Should now be able to form segments for a central angle of equal measure to (1/2)*(Arc(AB)-Arc(CD))
            Segment od = new Segment(o, d); segments.Add(od);
            Segment of = new Segment(o, f); segments.Add(of);

            List <Point> pnts = new List <Point>();

            pnts.Add(a);
            pnts.Add(b);
            pnts.Add(c);
            collinear.Add(new Collinear(pnts));

            pnts = new List <Point>();
            pnts.Add(c);
            pnts.Add(d);
            pnts.Add(e);
            collinear.Add(new Collinear(pnts));

            parser = new LiveGeometry.TutorParser.HardCodedParserMain(points, collinear, segments, circles, onoff);

            Segment ac = (Segment)parser.Get(new Segment(a, c));
            Segment ce = (Segment)parser.Get(new Segment(c, e));
            CircleSegmentIntersection cInter  = (CircleSegmentIntersection)parser.Get(new CircleSegmentIntersection(b, circleO, ac));
            CircleSegmentIntersection cInter2 = (CircleSegmentIntersection)parser.Get(new CircleSegmentIntersection(d, circleO, ce));

            given.Add(new Strengthened(cInter, new Tangent(cInter)));
            given.Add(new Strengthened(cInter2, new Tangent(cInter2)));

            MinorArc a1 = (MinorArc)parser.Get(new MinorArc(circleO, b, d));
            MajorArc a2 = (MajorArc)parser.Get(new MajorArc(circleO, b, d));
            MinorArc centralAngleArc = (MinorArc)parser.Get(new MinorArc(circleO, d, f));

            given.Add(new GeometricArcEquation(new Multiplication(new NumericValue(2), centralAngleArc), new Subtraction(a2, a1)));

            goals.Add(new GeometricCongruentAngles((Angle)parser.Get(new Angle(a, c, e)), (Angle)parser.Get(new Angle(d, o, f))));
            goals.Add(new GeometricCongruentSegments((Segment)parser.Get(new Segment(b, c)), (Segment)parser.Get(new Segment(c, d))));
        }
        //               A
        //              /)
        //             /  )
        //            /    )
        // center:   O      )
        //            \    )
        //             \  )
        //              \)
        //               C
        //
        //               D
        //              /)
        //             /  )
        //            /    )
        // center:   Q      )
        //            \    )
        //             \  )
        //              \)
        //               F
        //
        // Congruent(Segment(AC), Segment(DF)) -> Congruent(Arc(A, C), Arc(D, F))
        //
        private static List <EdgeAggregator> InstantiateForwardPartOfTheorem(CongruentSegments cas)
        {
            List <EdgeAggregator> newGrounded = new List <EdgeAggregator>();

            //
            // Acquire the circles for which the segments are chords.
            //
            List <Circle> circles1 = Circle.GetChordCircles(cas.cs1);
            List <Circle> circles2 = Circle.GetChordCircles(cas.cs2);

            //
            // Make all possible combinations of arcs congruent
            //
            foreach (Circle circle1 in circles1)
            {
                // Create the appropriate type of arcs from the chord and the circle
                List <Semicircle> c1semi  = null;
                MinorArc          c1minor = null;
                MajorArc          c1major = null;

                if (circle1.DefinesDiameter(cas.cs1))
                {
                    c1semi = CreateSemiCircles(circle1, cas.cs1);
                }
                else
                {
                    c1minor = new MinorArc(circle1, cas.cs1.Point1, cas.cs1.Point2);
                    c1major = new MajorArc(circle1, cas.cs1.Point1, cas.cs1.Point2);
                }

                foreach (Circle circle2 in circles2)
                {
                    //The two circles must be the same or congruent
                    if (circle1.radius == circle2.radius)
                    {
                        List <Semicircle> c2semi  = null;
                        MinorArc          c2minor = null;
                        MajorArc          c2major = null;

                        List <GeometricCongruentArcs> congruencies = new List <GeometricCongruentArcs>();
                        if (circle2.DefinesDiameter(cas.cs2))
                        {
                            c2semi = CreateSemiCircles(circle2, cas.cs2);
                            congruencies.AddRange(EquateSemiCircles(c1semi, c2semi));
                        }
                        else
                        {
                            c2minor = new MinorArc(circle2, cas.cs2.Point1, cas.cs2.Point2);
                            c2major = new MajorArc(circle2, cas.cs2.Point1, cas.cs2.Point2);
                            congruencies.Add(new GeometricCongruentArcs(c1minor, c2minor));
                            congruencies.Add(new GeometricCongruentArcs(c1major, c2major));
                        }

                        // For hypergraph
                        List <GroundedClause> antecedent = new List <GroundedClause>();
                        antecedent.Add(cas.cs1);
                        antecedent.Add(cas.cs2);
                        antecedent.Add(cas);

                        foreach (GeometricCongruentArcs gcas in congruencies)
                        {
                            newGrounded.Add(new EdgeAggregator(antecedent, gcas, forwardAnnotation));
                        }
                    }
                }
            }

            return(newGrounded);
        }