// // (a - b) + c // a + (b - c) = (b - c) + a // // First subtraction x = (a - b)...then append (x + c). // private static List <FigSynthProblem> ConstructParenSubtractionThenAppend(List <ShapeType> shapes) { // // Construct a - b // Figure defaultLargeFigure = Figure.ConstructDefaultShape(shapes[0]); List <FigSynthProblem> aMinusB = SubtractShape(defaultLargeFigure, shapes[1]); // // For each of the aMinusB problems, the outer bounds is defined by a shape; append the new shape. // List <FigSynthProblem> newSynths = new List <FigSynthProblem>(); foreach (FigSynthProblem top in aMinusB) { List <FigSynthProblem> bMinusC = AddShape(((top as BinarySynthOperation).leftProblem as UnarySynth).figure, shapes[2]); foreach (FigSynthProblem bc in bMinusC) { newSynths.Add(FigSynthProblem.AppendAddition(top, bc)); } } return(newSynths); }
// // Append to an existent problem. // public static List <FigSynthProblem> AddShape(FigSynthProblem problem, ShapeType type) { // Create a polygon based only on exterior segments. Polygon outer = Polygon.MakePolygon(problem.GetExteriorSegments()); // Append the shapes List <FigSynthProblem> newSynths = AddShape(outer, type); // Create the new problems by appending. List <FigSynthProblem> appended = new List <FigSynthProblem>(); foreach (FigSynthProblem synth in newSynths) { appended.Add(FigSynthProblem.AppendAddition(problem, synth)); } return(appended); }