Exemplo n.º 1
0
        //
        // Take the angle congruence and bisector and create the AngleBisector relation
        //
        private static List<EdgeAggregator> InstantiateToMedian(Triangle tri, SegmentBisector sb, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // The Bisector cannot be a side of the triangle.
            if (tri.CoincidesWithASide(sb.bisector) != null) return newGrounded;

            // Acquire the intersection segment that coincides with the base of the triangle
            Segment triangleBaseCandidate = sb.bisected.OtherSegment(sb.bisector);
            Segment triangleBase = tri.CoincidesWithASide(triangleBaseCandidate);
            if (triangleBase == null) return newGrounded;

            // The candidate base and the actual triangle side must equate exactly
            if (!triangleBase.HasSubSegment(triangleBaseCandidate) || !triangleBaseCandidate.HasSubSegment(triangleBase)) return newGrounded;

            // The point opposite the base of the triangle must be within the endpoints of the bisector
            Point oppPoint = tri.OtherPoint(triangleBase);
            if (!sb.bisector.PointLiesOnAndBetweenEndpoints(oppPoint)) return newGrounded;

            // -> Median(Segment(V, C), Triangle(A, B, C))
            Median newMedian = new Median(sb.bisector, tri);

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

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

            return newGrounded;
        }