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)); }
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)); }
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 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)); }