예제 #1
0
        public static List <GenericInstantiator.EdgeAggregator> CreateTransitiveCongruence(Congruent congruent1, Congruent congruent2)
        {
            List <GenericInstantiator.EdgeAggregator> newGrounded = new List <GenericInstantiator.EdgeAggregator>();

            //
            // Create the antecedent clauses
            //
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(congruent1);
            antecedent.Add(congruent2);

            //
            // Create the consequent clause
            //
            Congruent newCC = null;

            if (congruent1 is CongruentSegments)
            {
                CongruentSegments css1 = congruent1 as CongruentSegments;
                CongruentSegments css2 = congruent2 as CongruentSegments;

                Segment shared = css1.SegmentShared(css2);

                newCC = new AlgebraicCongruentSegments(css1.OtherSegment(shared), css2.OtherSegment(shared));
            }
            else if (congruent1 is CongruentAngles)
            {
                CongruentAngles cas1 = congruent1 as CongruentAngles;
                CongruentAngles cas2 = congruent2 as CongruentAngles;

                Angle shared = cas1.AngleShared(cas2);

                newCC = new AlgebraicCongruentAngles(cas1.OtherAngle(shared), cas2.OtherAngle(shared));
            }

            if (newCC == null)
            {
                System.Diagnostics.Debug.WriteLine("");
                throw new NullReferenceException("Unexpected Problem in Atomic substitution...");
            }

            newGrounded.Add(new GenericInstantiator.EdgeAggregator(antecedent, newCC, annotation));

            return(newGrounded);
        }
예제 #2
0
        public static List <GenericInstantiator.EdgeAggregator> CreateTransitiveProportion(ProportionalAngles pss, CongruentAngles conAngs)
        {
            List <GenericInstantiator.EdgeAggregator> newGrounded = new List <GenericInstantiator.EdgeAggregator>();

            //// Did either of these proportions come from the other?
            //if (pss.HasRelationPredecessor(conAngs) || conAngs.HasRelationPredecessor(pss)) return newGrounded;

            //
            // Create the antecedent clauses
            //
            List <GroundedClause> antecedent = new List <GroundedClause>();

            antecedent.Add(pss);
            antecedent.Add(conAngs);

            //
            // Create the consequent clause
            //
            Angle shared = pss.AngleShared(conAngs);

            AlgebraicProportionalAngles newPS = new AlgebraicProportionalAngles(pss.OtherAngle(shared), conAngs.OtherAngle(shared));

            // Update relationship among the congruence pairs to limit cyclic information generation
            //newPS.AddPredecessor(pss);
            //newPS.AddPredecessor(conAngs);

            newGrounded.Add(new GenericInstantiator.EdgeAggregator(antecedent, newPS, propAnnotation));

            return(newGrounded);
        }
        private static List<EdgeAggregator> IndirectRelations(CongruentAngles cas, AnglePairRelation relation1, AnglePairRelation relation2)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Do we have the same type of relation?
            if (relation1.GetType() != relation2.GetType()) return newGrounded;

            //
            // Determine the shared values amongst the relations
            //
            Angle shared1 = relation1.AngleShared(cas);
            if (shared1 == null) return newGrounded;

            Angle shared2 = cas.OtherAngle(shared1);
            if (!relation2.HasAngle(shared2)) return newGrounded;

            Angle otherAngle1 = relation1.OtherAngle(shared1);
            Angle otherAngle2 = relation2.OtherAngle(shared2);

            // Avoid generating a reflexive relationship
            if (otherAngle1.Equates(otherAngle2)) return newGrounded;

            //
            // Congruent(Angle(1), Angle(3))
            //
            // The other two angles from the relation pairs are then congruent
            GeometricCongruentAngles gcas = new GeometricCongruentAngles(otherAngle1, otherAngle2);

            // Avoid direct cyclic congruent angle generation
            if (cas.StructurallyEquals(gcas)) return newGrounded;

            // Construct hyperedge
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(cas);
            antecedent.Add(relation1);
            antecedent.Add(relation2);

            //
            // AnglePairRelation(Angle(1), Angle(4)),
            // AnglePairRelation(Angle(2), Angle(3)),
            //
            if (relation1 is Complementary && relation2 is Complementary)
            {
                Complementary comp1 = new Complementary(shared1, otherAngle2);
                Complementary comp2 = new Complementary(shared2, otherAngle1);

                newGrounded.Add(new EdgeAggregator(antecedent, comp1, compAnnotation));
                newGrounded.Add(new EdgeAggregator(antecedent, comp2, compAnnotation));
            }
            else if (relation1 is Supplementary && relation2 is Supplementary)
            {
                Supplementary supp1 = new Supplementary(shared1, otherAngle2);
                Supplementary supp2 = new Supplementary(shared2, otherAngle1);

                newGrounded.Add(new EdgeAggregator(antecedent, supp1, suppAnnotation));
                newGrounded.Add(new EdgeAggregator(antecedent, supp2, suppAnnotation));
            }
            else
            {
                throw new ArgumentException("RelationsOfCongruent:: Expected a supplementary or complementary angle, not " + relation1.GetType());
            }

            newGrounded.Add(new EdgeAggregator(antecedent, gcas, relation1 is Complementary ? compAnnotation : suppAnnotation));

            return newGrounded;
        }
예제 #4
0
        public static List<GenericInstantiator.EdgeAggregator> CreateTransitiveProportion(ProportionalAngles pss, CongruentAngles conAngs)
        {
            List<GenericInstantiator.EdgeAggregator> newGrounded = new List<GenericInstantiator.EdgeAggregator>();

            //// Did either of these proportions come from the other?
            //if (pss.HasRelationPredecessor(conAngs) || conAngs.HasRelationPredecessor(pss)) return newGrounded;

            //
            // Create the antecedent clauses
            //
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(pss);
            antecedent.Add(conAngs);

            //
            // Create the consequent clause
            //
            Angle shared = pss.AngleShared(conAngs);

            AlgebraicProportionalAngles newPS = new AlgebraicProportionalAngles(pss.OtherAngle(shared), conAngs.OtherAngle(shared));

            // Update relationship among the congruence pairs to limit cyclic information generation
            //newPS.AddPredecessor(pss);
            //newPS.AddPredecessor(conAngs);

            newGrounded.Add(new GenericInstantiator.EdgeAggregator(antecedent, newPS, propAnnotation));

            return newGrounded;
        }
예제 #5
0
        //
        // 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;
        }