示例#1
0
        public override bool CanBeStrengthenedTo(GroundedClause gc)
        {
            RightAngle ra = gc as RightAngle;

            if (ra == null)
            {
                return(false);
            }

            return(this.StructurallyEquals(ra));
        }
示例#2
0
        // CTA: Be careful with equality; this is object-based equality
        // If we check for angle measure equality that is distinct.
        // If we check to see that a different set of remote vertices describes this angle, that is distinct.
        public override bool Equals(Object obj)
        {
            RightAngle angle = obj as RightAngle;

            if (angle == null)
            {
                return(false);
            }

            // Measures must be the same.
            if (!Utilities.CompareValues(this.measure, angle.measure))
            {
                return(false);
            }

            return(base.Equals(obj) && StructurallyEquals(obj));
        }
        //
        // DO NOT generate a new clause, instead, report the result and generate all applicable
        //
        private static List<EdgeAggregator> StrengthenToRightTriangle(Triangle tri, RightAngle ra, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // This angle must belong to this triangle.
            if (!tri.HasAngle(ra)) return newGrounded;

            // Strengthen the old triangle to a right triangle
            Strengthened newStrengthened = new Strengthened(tri, new RightTriangle(tri));
            tri.SetProvenToBeRight();

            // Hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(tri);
            antecedent.Add(original);

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

            return newGrounded;
        }
示例#4
0
        /// <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)
            {
                RightAngle ra = gc as RightAngle;
                if (ra != null)
                {
                    givens.Add(ra);
                }
            }

            List<Angle> rightAngles = new List<Angle>();
            //Populate list with possible choices
            foreach (Angle a in parser.backendParser.implied.angles)
            {
                if (a.measure == 90)
                {
                    RightAngle ra = new RightAngle(a);
                    if (!StructurallyContains(givens, ra))
                    {
                        rightAngles.Add(ra);
                    }
                }
            }

            options.ItemsSource = null; //Makes sure the box is graphically updated.
            options.ItemsSource = rightAngles;
        }
示例#5
0
        private static List<EdgeAggregator> InstantiateToRectangle(Parallelogram parallelogram, RightAngle ra, GroundedClause originalPara, GroundedClause originalRightAngle)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Does this right angle apply to this quadrilateral?
            if (!parallelogram.HasAngle(ra)) return newGrounded;

            //
            // Create the new Rectangle object
            //
            Strengthened newRectangle = new Strengthened(parallelogram, new Rectangle(parallelogram));

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(originalPara);
            antecedent.Add(originalRightAngle);

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

            return newGrounded;
        }
        //
        // RightAngle(A, B, C), Angle(A, B, X) + Angle(X, B, C) = 90 -> Complementary(Angle(A, B, X), Angle(X, B, C))
        //
        public static List<EdgeAggregator> InstantiateToComplementary(AngleEquation eq, RightAngle ra, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            //
            // Acquire the two angles from the equation
            //
            KeyValuePair<int, int> cards = eq.GetCardinalities();
            List<GroundedClause> terms = cards.Key == 2 ? eq.lhs.CollectTerms() : eq.rhs.CollectTerms();
            List<GroundedClause> singleton = cards.Key == 1 ? eq.lhs.CollectTerms() : eq.rhs.CollectTerms();

            Angle angle1 = terms[0] as Angle;
            Angle angle2 = terms[1] as Angle;

            // Create the resultant angle to compare to the input right angle
            Segment shared = angle1.IsAdjacentTo(angle2);
            if (!ra.HasSegment(angle1.OtherRayEquates(shared)) || !ra.HasSegment(angle2.OtherRayEquates(shared))) return newGrounded;

            // Success, we have correspondence
            Complementary comp = new Complementary(angle1, angle2);

            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);

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

            return newGrounded;
        }
        //
        // Implements 'transitivity' with right angles; that is, we may know two angles are congruent and if one is a right angle, the other is well
        //
        // Congruent(Angle(A, B, C), Angle(D, E, F), RightAngle(A, B, C) -> RightAngle(D, E, F)
        //
        public static List<EdgeAggregator> InstantiateToRightAngle(RightAngle ra, CongruentAngles cas, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // The congruent must have the given angle in order to generate
            if (!cas.HasAngle(ra)) return newGrounded;

            Angle toBeRight = cas.OtherAngle(ra);
            Strengthened newRightAngle = new Strengthened(toBeRight, new RightAngle(toBeRight));

            List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(original);
            antecedent.Add(cas);

            newGrounded.Add(new EdgeAggregator(antecedent, newRightAngle, transAnnotation));

            return newGrounded;
        }
        private static List<EdgeAggregator> InstantiateToPerpendicular(Intersection inter, RightAngle ra, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // This angle must apply to this intersection (same vertex as well as the segments inducing this angle)
            if (!inter.InducesNonStraightAngle(ra)) return newGrounded;

            // We are strengthening an intersection to a perpendicular 'labeling'
            Strengthened streng = new Strengthened(inter, new Perpendicular(inter));

            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(original);
            antecedent.Add(inter);

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

            return newGrounded;
        }
示例#9
0
        private static List<EdgeAggregator> InstantiateToSquare(Rhombus rhombus, RightAngle ra, GroundedClause originalRhom, GroundedClause originalRightAngle)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Does this right angle apply to this quadrilateral?
            if (!rhombus.HasAngle(ra)) return newGrounded;

            //
            // Create the new Square object
            //
            Strengthened newSquare = new Strengthened(rhombus, new Square(rhombus));

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(originalRhom);
            antecedent.Add(originalRightAngle);

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

            return newGrounded;
        }