示例#1
0
        private static Result cT(DateTime startTime)
        {
            var scale = Solver.Solver.ScaleDown;

            var start = new Point(120, 180);
            var end = new Point(320, 220);

            var a = new PointD(100, 200);
            var b = new PointD(100, 100);

            var c = new PointD(300, 200);
            var d = new PointD(300, 100);

            var lines = new[]
            {
                new LineD(new PointD(250, 300), new PointD(250, 150) ),

                new LineD(a, new PointD(200, 200) ),
                new LineD(b, new PointD(200, 100) ),
                new LineD(a, b ),

                new LineD(c, new PointD(400, 200) ),
                new LineD(d, new PointD(400, 100) ),

                new LineD( new PointD(300, 300), d ),

                new LineD(new PointD(250, 300), new PointD(300, 300) ),
                new LineD(new Point(start.X - scale, start.Y +scale), new PointD(start.X - scale, start.Y +scale)),

              }.ToList();

             /*   var lastSolutionLinePoints = new int[] { 24, 36, 34, 36, 40, 36, 46, 46, 46, 54, 52, 64, 58, 64, 64, 54, 64, 44, 64, 44 };
              var lastSolutionLines = LineD.CreateLists(lastSolutionLinePoints, scale, scale);
              var lastSolutionLines2 = LineD.CreateLists(lastSolutionLinePoints, scale, -scale);

              lines.AddRange(lastSolutionLines);
              lines.AddRange(lastSolutionLines2);*/

            var bb = new BoundingBox(new Point(start.X, start.Y), new Point(end.X + 2, 320));

            var boxesForProperEnd = new[]
            {
                  new BoundingBox(new Point(248, 250), new Point(500, 400)),
                  new BoundingBox(new Point(300, 200), new Point(500, 400))
              };

            var boxesForAux2 = new[]
            {
                  new BoundingBox(new Point(248, 250), new Point(275, 400)),

              };

            var auxEndPoint = new Point(249, 300);
            var auxEndPoint2 = new Point(301, 300);
            var end1 = end;
            Func<Point, Point> auxEnd = point =>
            {
                point = point.ScaleUp(scale);
                if (boxesForAux2.Any(box => box.IsInside(point)))
                {
                    return auxEndPoint2;
                }

                if (boxesForProperEnd.Any(box => box.IsInside(point)))
                {
                    return end1;
                }

                return auxEndPoint;
            };

            // lines = new LineD[] {};

            if (Solver.Solver.SwapStartAndEnd)
            {
                Helpers.Swap(ref start, ref end);
            }
            var desc = new Description(new Car(start), end, lines.ToList(), bb, Solver.Solver.MaxSteps, auxEnd).ScaleDown(scale);

            return Solver.Solver.DoIt(desc, LogResult(startTime, start.ScaleDown(scale)), LogInfo(startTime, start.ScaleDown(scale)),
                 false);
        }