Ejemplo n.º 1
0
        protected override void InternalVisualize(TestCaseUI ui)
        {
            ui.Log("D = " + distance);
            ui.Log("V = " + v);
            // Горизонт
            ui.Line(-100, 0, 100, 0, new Pen(Color.Black, 3));
            // Цель
            ui.Circle(50, 0, 2, new Pen(Color.Blue, 1));
            if (LastException == null)
            {
                //Траектория
                foreach (var dot in trajectory.Where((p, i) => i%10 == 0))
                    ui.Dot(-50 + dot.Item1*100/distance, -dot.Item2*100/distance, Color.Red);
                ui.Circle(-50, 0, 1, new Pen(Color.Black, 5));

                if (trajectory.Any())
                {
                    // Пушка
                    ui.Line(-50, 0, -50 + 10 * Math.Cos(angle), -10 * Math.Sin(angle), new Pen(Color.Black, 3));
                    ui.Log("Угол прицеливания: " + 180 * angle / Math.PI + "°");
                    ui.Log("Высота над целью = " + trajectory.Last().Item2);
                    ui.Log("Время снаряда в полете = " + time);
                }
            }
        }
Ejemplo n.º 2
0
 public static void DrawFigure(TestCaseUI ui)
 {
     ui.Line(-50, -10, -50, 10, TestCase.neutralPen);
     ui.Line(50, -10, 50, 10, TestCase.neutralPen);
     ui.Line(-50, 10, 0, 60, TestCase.neutralPen);
     ui.Line(50, 10, 0, 60, TestCase.neutralPen);
     ui.Arc(0, -10, 50, 180, 180, TestCase.neutralPen);
 }
Ejemplo n.º 3
0
 protected override void InternalVisualize(TestCaseUI ui)
 {
     ui.Log("Wall inclanation: " + ToGradus(wallInclanation));
     ui.Log("Direction: " + ToGradus(initialDirection));
     ui.Line(-100 * Math.Cos(wallInclanation), 100 * Math.Sin(wallInclanation), 100 * Math.Cos(wallInclanation), -100 * Math.Sin(wallInclanation), new Pen(Color.Black, 1));
     ui.Line(-50 * Math.Cos(initialDirection), 50 * Math.Sin(initialDirection), 0, 0, new Pen(Color.Red, 3));
     ui.Line(50 * Math.Cos(angle), -50 * Math.Sin(angle), 0, 0, new Pen(Color.Red, 3) { DashStyle = DashStyle.Dash });
     ui.Line(50 * Math.Cos(expectedFinalDirection), -50 * Math.Sin(expectedFinalDirection), 0, 0, new Pen(Color.Green, 1) { DashStyle = DashStyle.Dash });
 }
Ejemplo n.º 4
0
 private void DrawWall(TestCaseUI ui, int x, int y)
 {
     var x1 = x*cellSize - 100;
     var y1 = y*cellSize - 100;
     var x2 = (x + 1) * cellSize - 101;
     var y2 = (y + 1) * cellSize - 101;
     ui.Rect(new Rectangle(x1, y1, cellSize, cellSize), neutralPen);
     ui.Line(x1, y1, x2, y2, neutralPen);
     ui.Line(x1, y2, x2, y1, neutralPen);
 }
Ejemplo n.º 5
0
        protected override void InternalVisualize(TestCaseUI ui)
        {
            ui.Line(-100, 0, 100, 0, neutralThinPen);
            ui.Line(0, -100, 0, 100, neutralThinPen);

            ui.Line(a.X, a.Y, b.X, b.Y, neutralPen);
            ui.Circle(a.X, a.Y, 1, neutralPen);
            ui.Circle(b.X, b.Y, 1, neutralPen);

            ui.Circle(x.X, x.Y, 3, neutralPen);
            ui.Circle(x.X, x.Y, answer, new Pen(actualAnswerPen.Color, 1) { DashStyle = DashStyle.Custom, DashPattern = new float[] { 4, 4 } });
            ui.Log("A = " + a);
            ui.Log("B = " + b);
            ui.Log("X = " + x);
            ui.Log("Expected distance " + distance);
            ui.Log("Calculated distance: {0}", answer);
        }
Ejemplo n.º 6
0
        protected override void InternalVisualize(TestCaseUI ui)
        {
            ui.Line(-100, 0, 100, 0, neutralThinPen);
            ui.Line(0, -100, 0, 100, neutralThinPen);

            FigureShape.DrawFigure(ui);

            ui.Line(50, -10, 50, 10, neutralPen);
            ui.Line(-50, 10, 0, 60, neutralPen);
            ui.Line(50, 10, 0, 60, neutralPen);
            ui.Arc(0, -10, 50, 180, 180, neutralPen);

            ui.Circle(x, y, 1, neutralPen);
            ui.Circle(x, y, answer, new Pen(actualAnswerPen.Color, 1) {DashStyle = DashStyle.Custom, DashPattern = new float[]{4, 4}});
            ui.Circle(x, y, distance, new Pen(expectedAnswerPen.Color, 1) {DashStyle = DashStyle.Custom, DashPattern = new float[]{4, 4}});
            ui.Log("Point: ({0}, {1})", x, y);
            ui.Log("Calculated distance: {0}", answer);
        }
Ejemplo n.º 7
0
 protected override void InternalVisualize(TestCaseUI ui)
 {
     for (int x = 0; x < maze.Size.Width; x++)
         for (int y = 0; y < maze.Size.Height; y++)
             if (maze.IsWall(new Point(x, y))) DrawWall(ui, x, y);
     Point last = maze.Robot;
     foreach (var cur in robot.Path)
     {
         ui.Line(Conv(last.X), Conv(last.Y), Conv(cur.X), Conv(cur.Y), actualAnswerPen);
         last = cur;
     }
     ui.Circle(Conv(robot.X), Conv(robot.Y), cellSize / 3.0, actualAnswerPen);
     ui.Circle(Conv(maze.Exit.X), Conv(maze.Exit.Y), cellSize / 2.5, expectedAnswerPen);
 }