示例#1
0
        public static Prostokat Obejmujacy(Prostokat r1, Prostokat r2)
        {
            double x1 = Math.Min(r1.p1.X, r2.p1.X);
            double x2 = Math.Max(r1.p2.X, r2.p2.X);
            double y1 = Math.Min(r1.p1.Y, r2.p1.Y);
            double y2 = Math.Max(r1.p2.Y, r2.p2.Y);

            return(new Prostokat(x1, x2, y1, y2));
        }
示例#2
0
        static void Main(string[] args)
        {
            Prostokat r1 = new Prostokat(0, 2, 1, 4);

            r1.Wyswietl();
            Console.WriteLine(r1.Pole());
            Prostokat r2 = new Prostokat(2, 3, 3, 3);

            Prostokat.Obejmujacy(r1, r2).Wyswietl();
        }