Пример #1
0
        //
        // Perform subtraction with a synthesized problem.
        //
        private static List<FigSynthProblem> Subtract(FigSynthProblem synth, ShapeType shapeType)
        {
            List<AtomicRegion> openAtoms = synth.GetOpenRegions();

            //
            // Perform subtraction with all open regions with the new shape.
            //
            List<FigSynthProblem> newSubs = new List<FigSynthProblem>();
            foreach (AtomicRegion atom in openAtoms)
            {
                ShapeAtomicRegion shapeAtom = atom as ShapeAtomicRegion;

                if (shapeAtom != null)
                {
                    newSubs.AddRange(SubtractShape(shapeAtom.shape, shapeType));
                }
            }

            //
            // Combine the existent problem with the newly subtracted region.
            //
            List<FigSynthProblem> newSynths = new List<FigSynthProblem>();
            foreach (FigSynthProblem newSub in newSubs)
            {
                // Makes a copy out of the outer problem and appends the subtraction operation.
                newSynths.Add(FigSynthProblem.AppendAtomicSubtraction(synth, newSub));
            }

            //
            // Eliminate symmetric problems.
            //
            return FigSynthProblem.RemoveSymmetric(newSynths);
        }