Ejemplo n.º 1
0
        public override bool Equals(Object obj)
        {
            Median med = obj as Median;

            if (med == null)
            {
                return(false);
            }
            return(theTriangle.Equals(med.theTriangle) && medianSegment.Equals(med.medianSegment) && base.Equals(obj));
        }
Ejemplo n.º 2
0
        public override bool StructurallyEquals(Object obj)
        {
            Median med = obj as Median;

            if (med == null)
            {
                return(false);
            }
            return(theTriangle.StructurallyEquals(med.theTriangle) && medianSegment.StructurallyEquals(med.medianSegment));
        }
Ejemplo n.º 3
0
        private static List<EdgeAggregator> InstantiateFromMedian(InMiddle im, Median median)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Which point is on the side of the triangle?
            Point vertexOnTriangle = median.theTriangle.GetVertexOn(median.medianSegment);
            Segment segmentCutByMedian = median.theTriangle.GetOppositeSide(vertexOnTriangle);
            Point midpt = segmentCutByMedian.FindIntersection(median.medianSegment);

            // This is to acquire the name of the midpoint, nothing more.
            if (midpt.Equals(median.medianSegment.Point1)) midpt = median.medianSegment.Point1;
            else if (midpt.Equals(median.medianSegment.Point2)) midpt = median.medianSegment.Point2;

            // Does this median apply to this InMiddle? Point check ...
            if (!im.point.StructurallyEquals(midpt)) return newGrounded;

            // Segment check
            if (!im.segment.StructurallyEquals(segmentCutByMedian)) return newGrounded;

            // Create the midpoint
            Strengthened newMidpoint = new Strengthened(im, new Midpoint(im));

            // For hypergraph
            List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(median);
            antecedent.Add(im);

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

            return newGrounded;
        }
Ejemplo n.º 4
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;
        }