private static List<EdgeAggregator> InstantiateToTheorem(Rectangle rectangle, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            //Instantiate this rectangle ONLY if the original figure has the rectangle diagonals drawn.
            if (rectangle.diagonalIntersection == null) return newGrounded;

            // Determine the CongruentSegments opposing sides and output that.
            GeometricCongruentSegments gcs = new GeometricCongruentSegments(rectangle.topLeftBottomRightDiagonal,
                                                                            rectangle.bottomLeftTopRightDiagonal);

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

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

            return newGrounded;
        }
示例#2
0
        public static void MakeRectangles(Segment side, double length, out Rectangle rect1, out Rectangle rect2)
        {
            //
            // First rectangle
            //
            Segment adj1 = side.GetPerpendicularByLength(side.Point1, length);
            Segment adj2 = side.GetPerpendicularByLength(side.Point2, length);

            Segment oppSide = new Segment(adj1.OtherPoint(side.Point1), adj2.OtherPoint(side.Point2));

            rect1 = new Rectangle(side, oppSide, adj1, adj2);

            //
            // Second rectangle
            //
            Segment otherAdj1 = adj1.GetOppositeSegment(side.Point1);
            Segment otherAdj2 = adj2.GetOppositeSegment(side.Point2);

            oppSide = new Segment(otherAdj1.OtherPoint(side.Point1), otherAdj2.OtherPoint(side.Point2));

            rect2 = new Rectangle(side, oppSide, otherAdj1, otherAdj2);
        }
示例#3
0
        private static List<EdgeAggregator> InstantiateFromRectangle(Rectangle rectangle, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            //
            // Determine the parallel opposing sides and output that.
            //
            List<Strengthened> newRightAngles = new List<Strengthened>();
            foreach (Angle rectAngle in rectangle.angles)
            {
                Angle figureAngle = Angle.AcquireFigureAngle(rectAngle);
                newRightAngles.Add(new Strengthened(figureAngle, new RightAngle(figureAngle)));
            }

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

            foreach (Strengthened rightAngle in newRightAngles)
            {
                newGrounded.Add(new EdgeAggregator(antecedent, rightAngle, annotation));
            }

            return newGrounded;
        }
示例#4
0
        public static new List<FigSynthProblem> SubtractShape(Figure outerShape, List<Connection> conns, List<Point> points)
        {
            // Possible quadrilaterals.
            List<Quadrilateral> quads = null;

            if (outerShape is ConcavePolygon) quads = Quadrilateral.GetQuadrilateralsFromPoints(outerShape as ConcavePolygon, points);
            else quads = Quadrilateral.GetQuadrilateralsFromPoints(points);

            List<FigSynthProblem> composed = new List<FigSynthProblem>();
            foreach (Quadrilateral quad in quads)
            {
                // Select only rectangles that don't match the outer shape.
                if (quad.VerifyRectangle() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    Rectangle rect = new Rectangle(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, rect);
                    try
                    {
                        subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, rect.points, rect));
                        composed.Add(subSynth);
                    }
                    catch (Exception) { }

                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }