Exemple #1
0
        public override bool Equals(Object obj)
        {
            //Causes infinite recursion -> if (obj is Midpoint) return (obj as Midpoint).Equals(this);

            InMiddle im = obj as InMiddle;

            if (im == null)
            {
                return(false);
            }
            return(im.point.Equals(point) && im.segment.Equals(segment));
        }
Exemple #2
0
        public override bool StructurallyEquals(Object obj)
        {
            if (obj is Midpoint)
            {
                return((obj as Midpoint).StructurallyEquals(this));
            }

            InMiddle im = obj as InMiddle;

            if (im == null)
            {
                return(false);
            }
            return(im.point.StructurallyEquals(point) && im.segment.StructurallyEquals(segment));
        }
        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;
        }
        public static List<EdgeAggregator> InstantiateFromSegmentBisector(InMiddle im, SegmentBisector sb, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Does this bisector apply to this InMiddle? Check point of intersection
            if (!im.point.StructurallyEquals(sb.bisected.intersect)) return newGrounded;

            // Segments must equate
            if (!im.segment.StructurallyEquals(sb.bisected.OtherSegment(sb.bisector))) return newGrounded;

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

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

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

            return newGrounded;
        }
Exemple #5
0
 public Midpoint(InMiddle im)
     : base(im.point, im.segment)
 {
 }
        //
        // Congruent(Segment(A, M), Segment(M, B)) -> Midpoint(M, Segment(A, B))
        //
        private static List<EdgeAggregator> InstantiateToMidpoint(InMiddle im, CongruentSegments css)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            Point midpoint = css.cs1.SharedVertex(css.cs2);

            // Does this InMiddle relate to the congruent segments?
            if (!im.point.StructurallyEquals(midpoint)) return newGrounded;

            // Do the congruent segments combine into a single segment equating to the InMiddle?
            Segment overallSegment = new Segment(css.cs1.OtherPoint(midpoint), css.cs2.OtherPoint(midpoint));
            if (!im.segment.StructurallyEquals(overallSegment)) return newGrounded;

            Strengthened newMidpoint = new Strengthened(im, new Midpoint(im));

            // For hypergraph
            List<GroundedClause> antecedent = new List<GroundedClause>();
            antecedent.Add(im);
            antecedent.Add(css);

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

            return newGrounded;
        }
        private static List<EdgeAggregator> InstantiateFromMidpoint(InMiddle im, Midpoint midpt, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            // Does this ImMiddle apply to this midpoint?
            if (!im.point.StructurallyEquals(midpt.point)) return newGrounded;
            if (!im.segment.StructurallyEquals(midpt.segment)) return newGrounded;

            // For hypergraph
            List<GroundedClause> antecedent = Utilities.MakeList<GroundedClause>(original);

            // Backward: Midpoint(M, Segment(A, B)) -> InMiddle(A, M, B)
            newGrounded.Add(new EdgeAggregator(antecedent, im, annotation));

            //
            // Forward: Midpoint(M, Segment(A, B)) -> Congruent(Segment(A,M), Segment(M,B))
            //
            Segment left = new Segment(midpt.segment.Point1, midpt.point);
            Segment right = new Segment(midpt.point, midpt.segment.Point2);
            GeometricCongruentSegments ccss = new GeometricCongruentSegments(left, right);
            newGrounded.Add(new EdgeAggregator(antecedent, ccss, annotation));

            return newGrounded;
        }
Exemple #8
0
 public Midpoint(InMiddle im) : base(im.point, im.segment)
 {
 }