Example #1
0
 public Rectangle(Rectangle rect)
 {
     X = rect.X;
     Y = rect.Y;
     W = rect.W;
     H = rect.H;
 }
Example #2
0
File: App.cs Project: ipzPZ121/OOP
        public static void Main(string[] args)
        {
            MyVector vec = new MyVector();
            vec.Append(1);
            vec.Append(23);
            vec.Append(234);
            vec.Append(4);
            vec.Append(9);

            vec.Insert(11, 1);
            vec.Remove(2);

            Console.WriteLine(vec);
            Console.WriteLine();

            Rectangle r1 = new Rectangle();
            Console.WriteLine(r1);
            Rectangle r2 = new Rectangle(5689);
            Console.WriteLine(r2);
            Rectangle r3 = new Rectangle(r2);
            Console.WriteLine(r3);
            Rectangle r4 = new Rectangle(23, 56, 85, 100);
            Console.WriteLine(r4);

            Console.WriteLine();
        }
Example #3
0
 public MyVector(Rectangle rect)
     : this()
 {
     arr = new int[4];
     arr[0] = rect.X;
     arr[1] = rect.Y;
     arr[2] = rect.X + rect.W;
     arr[3] = rect.Y + rect.H;
 }
Example #4
0
        public Rectangle Intersect(Rectangle rect)
        {
            Rectangle intersect = new Rectangle();
            intersect.X = X > rect.X ? X : rect.X;
            intersect.Y = Y > rect.Y ? Y : rect.Y;
            intersect.W = ((W - rect.W) > 0) ? (W - rect.W) : ((W - rect.W) * -1);
            intersect.H = ((H - rect.H) > 0) ? (H - rect.H) : ((H - rect.H) * -1);

            return intersect;
        }