예제 #1
0
        private static GeometryTestbed.FigSynthShadedAreaProblem ConstructProblem(FigSynthProblem problem)
        {
            GeometryTestbed.FigSynthShadedAreaProblem shadedArea = new GeometryTestbed.FigSynthShadedAreaProblem(true, true);

            //
            // Name the problem (uniquely).
            //
            shadedArea.SetName("Fig-Synthesized " + (figCounter++));

            //
            // Construct the points.
            //
            List<Point> points = problem.CollectPoints();
            shadedArea.SetPoints(points);

            //
            // Construct the collinear relationships.
            //
            List<Segment> segments;
            List<Collinear> collinear;

            AcquireCollinearAndSegments(problem.CollectSegments(), points, out segments, out collinear);

            shadedArea.SetSegments(segments);
            shadedArea.SetCollinear(collinear);

            //
            // Construct circles.
            //
            shadedArea.SetCircles(problem.CollectCircles());

            //
            // Invoke the parser.
            //
            shadedArea.InvokeParser();

            //
            // Set the wanted atomic regions.
            //
            shadedArea.SetWantedRegions(shadedArea.GetRemainingRegionsFromParser(problem));

            //
            // Set the known values.
            // Acquire all of the givens using constant propagation for each figure construction.
            //
            shadedArea.SetKnowns(problem.AcquireKnowns());

            //
            // Set the problem given clauses.
            //
            List<GroundedClause> givens = problem.GetGivens();
            problem.GetMidpoints().ForEach(m => givens.Add(m));
            shadedArea.SetGivens(givens);

            //
            // Set the actual area of the solution (area of wanted regions).
            //
            shadedArea.SetSolutionArea(problem.GetCoordinateArea());

            return shadedArea;
        }