예제 #1
0
        private static List<EdgeAggregator> InstantiateAngles(Angle angle1, Angle angle2)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // An angle may have multiple names
            if (angle1.Equates(angle2)) return newGrounded;

            if (!angle1.GetVertex().Equals(angle2.GetVertex())) return newGrounded;

            // Determine the shared segment if we have an adjacent situation
            Segment shared = angle1.IsAdjacentTo(angle2);

            if (shared == null) return newGrounded;

            //
            // If we combine these two angles, the result is a third angle, which, when measured,
            // would be less than 180; this is contradictory since we measuare angles greedily and no circular angle is measured as > 180
            //
            if (angle1.measure + angle2.measure > 180) return newGrounded;

            // Angle(A, B, C), Angle(C, B, D) -> Angle(A, B, C) + Angle(C, B, D) = Angle(A, B, D)
            Point vertex = angle1.GetVertex();
            Point exteriorPt1 = angle2.OtherPoint(shared);
            Point exteriorPt2 = angle1.OtherPoint(shared);
            Angle newAngle = new Angle(exteriorPt1, vertex, exteriorPt2);
            Addition sum = new Addition(angle1, angle2);
            GeometricAngleEquation geoAngEq = new GeometricAngleEquation(sum, newAngle);
            geoAngEq.MakeAxiomatic(); // This is an axiomatic equation

            // For hypergraph construction
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(angle1);
            antecedent.Add(angle2);

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

            return newGrounded;
        }
        private static List<EdgeAggregator> CheckAndGeneratePerpendicularImplyCongruentAdjacent(Perpendicular perp, Angle angle1, Angle angle2)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            if (!Utilities.CompareValues(angle1.measure + angle2.measure, 90)) return newGrounded;

            // The perpendicular intersection must occur at the same vertex of both angles (we only need check one).
            if (!(angle1.GetVertex().Equals(perp.intersect) && angle2.GetVertex().Equals(perp.intersect))) return newGrounded;

            // Are the angles adjacent?
            Segment sharedRay = angle1.IsAdjacentTo(angle2);
            if (sharedRay == null) return newGrounded;

            // Do the non-shared rays for both angles align with the segments defined by the perpendicular intersection?
            if (!perp.DefinesBothRays(angle1.OtherRayEquates(sharedRay), angle2.OtherRayEquates(sharedRay))) return newGrounded;

            //
            // Now we have perpendicular -> complementary angles scenario
            //
            Complementary cas = new Complementary(angle1, angle2);

            // Construct hyperedge
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(perp);
            antecedent.Add(angle1);
            antecedent.Add(angle2);

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

            return newGrounded;
        }