Beispiel #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 rhombi that don't match the outer shape.
                if (quad.VerifyRhombus() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    Rhombus rhombus = new Rhombus(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, rhombus);

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

                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
        public static new List<FigSynthProblem> SubtractShape(Figure outerShape, List<Connection> conns, List<Point> points)
        {
            // Possible triangles.
            List<Triangle> tris = null;

            if (outerShape is ConcavePolygon) tris = Triangle.GetTrianglesFromPoints(outerShape as ConcavePolygon, points);
            else tris = Triangle.GetTrianglesFromPoints(points);

            List<FigSynthProblem> composed = new List<FigSynthProblem>();
            foreach (Triangle tri in tris)
            {
                // Select only parallelograms that don't match the outer shape.
                if (tri.IsEquilateral() && !tri.StructurallyEquals(outerShape))
                {
                    EquilateralTriangle eqTri = new EquilateralTriangle(tri);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, eqTri);

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

                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Beispiel #3
0
        public new static List <FigSynthProblem> SubtractShape(Figure outerShape, List <Connection> conns, List <Point> points)
        {
            List <FigSynthProblem> composed = new List <FigSynthProblem>();

            // Possible triangles.
            List <Triangle> tris = null;

            if (outerShape is ConcavePolygon)
            {
                tris = Triangle.GetTrianglesFromPoints(outerShape as ConcavePolygon, points);
            }
            else
            {
                tris = Triangle.GetTrianglesFromPoints(points);
            }

            // Check all triangles to determine applicability.
            foreach (Triangle tri in tris)
            {
                // Avoid equilateral, isosceles, and right triangles.
                if (!tri.IsEquilateral() && !tri.IsIsosceles() && !tri.isRightTriangle() && !tri.StructurallyEquals(outerShape))
                {
                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, tri);

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

            return(FigSynthProblem.RemoveSymmetric(composed));
        }
Beispiel #4
0
        public new static 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));
        }
        public new static 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 isosceles trapezoids that don't match the outer shape.
                if (quad.VerifyIsoscelesTrapezoid() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    IsoscelesTrapezoid isoTrap = new IsoscelesTrapezoid(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, isoTrap);
                    subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, isoTrap.points, isoTrap));

                    composed.Add(subSynth);
                }
            }

            return(FigSynthProblem.RemoveSymmetric(composed));
        }
Beispiel #6
0
        public new static List <FigSynthProblem> SubtractShape(Figure outerShape, List <Connection> conns, List <Point> points)
        {
            List <Triangle> tris = Triangle.GetTrianglesFromPoints(points);

            List <FigSynthProblem> composed = new List <FigSynthProblem>();

            foreach (Triangle tri in tris)
            {
                // Only create right triangles that are NOT the outershape.
                if (tri.isRightTriangle() && !tri.StructurallyEquals(outerShape))
                {
                    RightTriangle rTri = new RightTriangle(tri);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, rTri);

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

            return(FigSynthProblem.RemoveSymmetric(composed));
        }
        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 isosceles trapezoids that don't match the outer shape.
                if (quad.VerifyIsoscelesTrapezoid() && !quad.HasSamePoints(outerShape as Polygon))
                {
                    IsoscelesTrapezoid isoTrap = new IsoscelesTrapezoid(quad);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, isoTrap);
                    subSynth.SetOpenRegions(FigSynthProblem.AcquireOpenAtomicRegions(conns, isoTrap.points, isoTrap));

                    composed.Add(subSynth);
                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Beispiel #8
0
        public override FigSynthProblem Copy()
        {
            SubtractionSynth copy = new SubtractionSynth(this.leftProblem.Copy(), this.rightProblem.Copy());

            copy.SetOpenRegions(new List <AtomicRegion>(this.openRegions));

            return(copy);
        }
Beispiel #9
0
        //
        // Append subtraction to this current problem; the subtraction occurs within one of the open atomic regions.
        //
        public static FigSynthProblem AppendAtomicSubtraction(FigSynthProblem that, FigSynthProblem toAppend)
        {
            BinarySynthOperation binaryAppend = toAppend as BinarySynthOperation;

            if (binaryAppend == null)
            {
                return(null);
            }

            // Verify that the outer part of toAppend is an open atomic region.
            if (!that.openRegions.Contains(new ShapeAtomicRegion((binaryAppend.leftProblem as UnarySynth).figure)))
            {
                throw new ArgumentException("Shape is not an open atomic region: " + (binaryAppend.leftProblem as UnarySynth).figure);
            }

            // Since the 'left' expression was an open region, the 'right' is the actual shape we are appending.
            SubtractionSynth newSub = new SubtractionSynth(that.Copy(), binaryAppend.rightProblem);

            // Update the open regions to the inner-most shape.
            newSub.SetOpenRegions(toAppend.openRegions);

            return(newSub);
        }
        public new static List <FigSynthProblem> SubtractShape(Figure outerShape, List <Connection> conns, List <Point> points)
        {
            // Possible triangles.
            List <Triangle> tris = null;

            if (outerShape is ConcavePolygon)
            {
                tris = Triangle.GetTrianglesFromPoints(outerShape as ConcavePolygon, points);
            }
            else
            {
                tris = Triangle.GetTrianglesFromPoints(points);
            }

            List <FigSynthProblem> composed = new List <FigSynthProblem>();

            foreach (Triangle tri in tris)
            {
                // Select only parallelograms that don't match the outer shape.
                if (tri.IsEquilateral() && !tri.StructurallyEquals(outerShape))
                {
                    EquilateralTriangle eqTri = new EquilateralTriangle(tri);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, eqTri);

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

            return(FigSynthProblem.RemoveSymmetric(composed));
        }
Beispiel #11
0
        public static new List<FigSynthProblem> SubtractShape(Figure outerShape, List<Connection> conns, List<Point> points)
        {
            List<FigSynthProblem> composed = new List<FigSynthProblem>();

            // Possible triangles.
            List<Triangle> tris = null;

            if (outerShape is ConcavePolygon) tris = Triangle.GetTrianglesFromPoints(outerShape as ConcavePolygon, points);
            else tris = Triangle.GetTrianglesFromPoints(points);

            // Check all triangles to determine applicability.
            foreach (Triangle tri in tris)
            {
                // Avoid equilateral, isosceles, and right triangles.
                if (!tri.IsEquilateral() && !tri.IsIsosceles() && !tri.isRightTriangle() && !tri.StructurallyEquals(outerShape))
                {
                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, tri);

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

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Beispiel #12
0
        public static new List<FigSynthProblem> SubtractShape(Figure outerShape, List<Connection> conns, List<Point> points)
        {
            List<Triangle> tris = Triangle.GetTrianglesFromPoints(points);

            List<FigSynthProblem> composed = new List<FigSynthProblem>();
            foreach (Triangle tri in tris)
            {
                // Only create right triangles that are NOT the outershape.
                if (tri.isRightTriangle() && !tri.StructurallyEquals(outerShape))
                {
                    RightTriangle rTri = new RightTriangle(tri);

                    SubtractionSynth subSynth = new SubtractionSynth(outerShape, rTri);

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

                }
            }

            return FigSynthProblem.RemoveSymmetric(composed);
        }
Beispiel #13
0
        public override FigSynthProblem Copy()
        {
            SubtractionSynth copy = new SubtractionSynth(this.leftProblem.Copy(), this.rightProblem.Copy());

            copy.SetOpenRegions(new List<AtomicRegion>(this.openRegions));

            return copy;
        }
Beispiel #14
0
        //
        // Append subtraction to this current problem; the subtraction occurs within one of the open atomic regions.
        //
        public static FigSynthProblem AppendAtomicSubtraction(FigSynthProblem that, FigSynthProblem toAppend)
        {
            BinarySynthOperation binaryAppend = toAppend as BinarySynthOperation;
            if (binaryAppend == null) return null;

            // Verify that the outer part of toAppend is an open atomic region.
            if (!that.openRegions.Contains(new ShapeAtomicRegion((binaryAppend.leftProblem as UnarySynth).figure)))
            {
                throw new ArgumentException("Shape is not an open atomic region: " + (binaryAppend.leftProblem as UnarySynth).figure);
            }

            // Since the 'left' expression was an open region, the 'right' is the actual shape we are appending.
            SubtractionSynth newSub = new SubtractionSynth(that.Copy(), binaryAppend.rightProblem);

            // Update the open regions to the inner-most shape.
            newSub.SetOpenRegions(toAppend.openRegions);

            return newSub;
        }