예제 #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);
                }
            }
        }
예제 #2
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);
        }
예제 #3
0
 protected override void InternalVisualize(TestCaseUI ui)
 {
     ui.Rect(new System.Drawing.Rectangle(r1.Left, r1.Top, r1.Width, r1.Height), neutralPen);
     ui.Rect(new System.Drawing.Rectangle(r2.Left, r2.Top, r2.Width, r2.Height), neutralPen);
     ui.Log("r1: {0}", r1);
     ui.Log("r2: {0}", r2);
     ui.Log("Solution: ");
     ui.Log("  intersected: {0} {1}", intersectedAnswer, intersected != intersectedAnswer ? "wrong!" : "");
     ui.Log("  intersection square: {0} {1}", intersectionSquareAnswer, intersectionSquare != intersectionSquareAnswer ? "wrong!" : "");
     ui.Log("  index of inner rectangle: {0} {1}", indexOfInnerRectAnswer, indexOfInnerRectangle != indexOfInnerRectAnswer ? "wrong!" : "");
 }
예제 #4
0
 protected override void InternalVisualize(TestCaseUI ui)
 {
     ui.Rect(r1, neutralPen);
     ui.Rect(r2, neutralPen);
     ui.Log("r1: {0}", r1);
     ui.Log("r2: {0}", r2);
     ui.Log("Solution: ");
     ui.Log("  intersected: {0} {1}", intersectedAnswer, intersected != intersectedAnswer ? "wrong!" : "");
     ui.Log("  intersection square: {0} {1}", intersectionSquareAnswer, intersectionSquare != intersectionSquareAnswer ? "wrong!" : "");
     ui.Log("  index of inner rectangle: {0} {1}", indexOfInnerRectAnswer, indexOfInnerRectangle != indexOfInnerRectAnswer ? "wrong!" : "");
 }
예제 #5
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
     });
 }
예제 #6
0
        protected override void InternalVisualize(TestCaseUI ui)
        {
            ui.Log("Calculated area: " + calculatedArea);
            ui.Log("Calculated isConvex: " + calculatedIsConvex);
            ui.Log("Expected area: " + area);
            ui.Log("Expected isConvex: " + isConvex);
            ui.Rect(new Rectangle(-90, -90, 180, 180), new Pen(Color.FromArgb(50, Color.Green), 1));
            Action <PointF> plot = p => ui.Circle(p.X, p.Y, 3, neutralPen);
            PointF          prev = scaledPoints.Last();

            foreach (var curr in scaledPoints)
            {
                plot(curr);
                ui.Line(prev.X, prev.Y, curr.X, curr.Y, neutralThinPen);
                prev = curr;
            }
        }
        protected override void InternalVisualize(TestCaseUI ui)
        {
            // Добавляет оси координат:
            //   - красная — OY
            //   - зеленая — OX
            ui.Line(0, 0, 0, 50, actualAnswerPen);
            ui.Line(0, 0, 50, 0, expectedAnswerPen);

            ui.Rect(new System.Drawing.Rectangle(r1.Left, r1.Top, r1.Width, r1.Height), neutralPen);
            ui.Rect(new System.Drawing.Rectangle(r2.Left, r2.Top, r2.Width, r2.Height), neutralPen);
            ui.Log("r1: {0}", r1);
            ui.Log("r2: {0}", r2);
            ui.Log("Solution: ");
            ui.Log("  intersected: {0} {1}", intersectedAnswer, intersected != intersectedAnswer ? "wrong!" : "");
            ui.Log("  intersection square: {0} {1}", intersectionSquareAnswer,
                   intersectionSquare != intersectionSquareAnswer ? "wrong!" : "");
            ui.Log("  index of inner rectangle: {0} {1}", indexOfInnerRectAnswer,
                   indexOfInnerRectangle != indexOfInnerRectAnswer ? "wrong!" : "");
        }
예제 #8
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);
        }
예제 #9
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);
        }