Ejemplo n.º 1
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));
        }
Ejemplo n.º 2
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));
        }
Ejemplo n.º 3
0
        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));
        }