Beispiel #1
0
 public static bool Intersects(VirtualRectangle r1, VirtualRectangle r2)
 {
     return
         ((
              (
                  ((r1.Left >= r2.Left && r1.Left <= r2.Right) || (r1.Right >= r2.Left && r1.Right <= r2.Right))
                  &&
                  ((r1.Top >= r2.Top && r1.Top <= r2.Bottom) || (r1.Bottom >= r2.Top && r1.Bottom <= r2.Bottom))
              )
              ||
              (
                  ((r2.Left >= r1.Left && r2.Left <= r1.Right) || (r2.Right >= r1.Left && r2.Right <= r1.Right))
                  &&
                  ((r2.Top >= r1.Top && r2.Top <= r1.Bottom) || (r2.Bottom >= r1.Top && r2.Bottom <= r1.Bottom))
              )
              )
          ||
          (
              (
                  ((r1.Left >= r2.Left && r1.Left <= r2.Right) || (r1.Right >= r2.Left && r1.Right <= r2.Right))
                  &&
                  ((r2.Top >= r1.Top && r2.Top <= r1.Bottom) || (r2.Bottom >= r1.Top && r2.Bottom <= r1.Bottom))
              )
              ||
              (
                  ((r2.Left >= r1.Left && r2.Left <= r1.Right) || (r2.Right >= r1.Left && r2.Right <= r1.Right))
                  &&
                  ((r1.Top >= r2.Top && r1.Top <= r2.Bottom) || (r1.Bottom >= r2.Top && r1.Bottom <= r2.Bottom))
              )
          ));
 }
Beispiel #2
0
 public bool Intersects(VirtualRectangle rect)
 {
     return(Intersects(this, rect));
 }