Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Prostokat p = new Prostokat(1, 2, 2, 4);

            Console.WriteLine("prostokąt [{0};{1}] [{2};{3}]", p.P1.X, p.P1.Y, p.P2.X, p.P2.Y);
            Console.WriteLine(p.bokA);
            Console.WriteLine(p.bokB);
        }
Пример #2
0
        public static Prostokat ProstokatWProstokacie(Prostokat r1, Prostokat r2)
        {
            double x1 = Math.Min(r1.P1.X, r2.P1.X);
            double y1 = Math.Min(r1.P1.Y, r2.P1.Y);

            double x2 = Math.Max(r1.P2.X, r2.P2.X);
            double y2 = Math.Max(r1.P2.Y, r2.P2.Y);

            return(new Prostokat(x1, y1, x2, y2));
        }