Пример #1
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 PartitionArcPoints(Circle circle, int endpt1, int endpt2, out List <Point> minorArcPoints, out List <Point> majorArcPoints)
        {
            minorArcPoints = new List <Point>();
            majorArcPoints = new List <Point>();
            Point e1 = circle.pointsOnCircle[endpt1];
            Point e2 = circle.pointsOnCircle[endpt2];

            // Traverse points and add to the appropriate list
            for (int i = 0; i < circle.pointsOnCircle.Count; i++)
            {
                if (i != endpt1 && i != endpt2)
                {
                    Point m = circle.pointsOnCircle[i];
                    if (Arc.BetweenMinor(m, new MinorArc(circle, e1, e2)))
                    {
                        minorArcPoints.Add(m);
                    }
                    else
                    {
                        majorArcPoints.Add(m);
                    }
                }
            }
        }