Ejemplo n.º 1
0
        public void line()
        {
            Console.Clear();
            Console.SetWindowSize(x, y);
            wall.Draw();

            string t = "";

            Console.SetCursorPosition(2, y - 2);
            Console.Write("Введите координаты линии (через пробел):");
            t = Console.ReadLine();
            wall.clear();
            string[]       tv = t.Split(' ').Where(z => z != "").ToArray();
            int            AX = int.Parse(tv[0]);
            int            AY = int.Parse(tv[1]);
            int            AZ = int.Parse(tv[2]);
            HorizontalLine L1 = new HorizontalLine(AX, AY, AZ, '═');

            t = "";
            Console.SetCursorPosition(2, 41);
            Console.Write("вертикальная линия (через пробел) :");
            t  = Console.ReadLine();
            tv = t.Split(' ').Where(z => z != "").ToArray();
            AX = int.Parse(tv[0]);
            AY = int.Parse(tv[1]);
            AZ = int.Parse(tv[2]);
            VerticalLine L2 = new VerticalLine(AX, AY, AZ, '║');

            wall.clear();
            L1.Draw();
            L2.Draw();
            if (L1.IsHit(L2))
            {
                Console.SetCursorPosition(2, y - 2); Console.Write("Линии пересекаются");
            }
            else
            {
                Console.SetCursorPosition(2, y - 2); Console.Write("Линии не пересекаются");
            }
            Console.ReadKey();
            Program.Main();
        }