public bool IntersectsWith(RectangleF rect) { return (rect.X < this.X + this.Width) && (this.X < (rect.X + rect.Width)) && (rect.Y < this.Y + this.Height) && (this.Y < rect.Y + rect.Height); }
public bool Intersects(RectangleF a, RectangleF b) { if (b.X < a.Right && a.X < b.Right && b.Y < a.Bottom) return a.Y < b.Bottom; return false; }
public void Intersect(RectangleF rect) { RectangleF result = RectangleF.Intersect(rect, this); this.X = result.X; this.Y = result.Y; this.Width = result.Width; this.Height = result.Height; }
public bool Contains(RectangleF rect) { return (this.X <= rect.X) && ((rect.X + rect.Width) <= (this.X + this.Width)) && (this.Y <= rect.Y) && ((rect.Y + rect.Height) <= (this.Y + this.Height)); }
public static RectangleF Intersect(RectangleF a, RectangleF b) { float x1 = Math.Max(a.X, b.X); float x2 = Math.Min(a.X + a.Width, b.X + b.Width); float y1 = Math.Max(a.Y, b.Y); float y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); if (x2 >= x1 && y2 >= y1) { return new RectangleF(x1, y1, x2 - x1, y2 - y1); } return RectangleF.Empty; }
public static RectangleF Inflate(RectangleF rect, float x, float y) { RectangleF r = rect; r.Inflate(x, y); return r; }