Example #1
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 squares that don't match the outer shape.
                if (quad.VerifySquare() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    Square square = new Square(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, square);

                    try
                    {
                        subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, square.points, square));
                        composed.Add(subSynth);
                    }
                    catch (Exception) { }

                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Example #2
0
        public static new List<FigSynthProblem> AppendShape(Figure outerShape, List<Segment> segments)
        {
            List<FigSynthProblem> composed = new List<FigSynthProblem>();
            foreach (Segment seg in segments)
            {
                Rectangle rect1;
                Rectangle rect2;

                Rectangle.MakeRectangles(seg, seg.Length, out rect1, out rect2);

                Square sq1 = new Square(rect1);
                Square sq2 = new Square(rect2);

                FigSynthProblem prob = Figure.MakeAdditionProblem(outerShape, sq2);
                if (prob != null) composed.Add(prob);

                prob = Figure.MakeAdditionProblem(outerShape, sq2);
                if (prob != null) composed.Add(prob);
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Example #3
0
        private static List<EdgeAggregator> InstantiateFromSquare(Square square, GroundedClause original)
        {
            List<EdgeAggregator> newGrounded = new List<EdgeAggregator>();

            //
            // Determine the parallel opposing sides and output that.
            //
            List<Strengthened> newRightAngles = new List<Strengthened>();
            foreach (Angle angle in square.angles)
            {
                Angle figureAngle = Angle.AcquireFigureAngle(angle);
                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;
        }