public bool IntersectsWith(GRect 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 static GRect Inflate(GRect rect, long x, long y) { GRect r = rect; r.Inflate(x, y); return(r); }
public bool Contains(GRect 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 GRect Union(GRect a, GRect b) { long x1 = Math.Min(a.X, b.X); long x2 = Math.Max(a.X + a.Width, b.X + b.Width); long y1 = Math.Min(a.Y, b.Y); long y2 = Math.Max(a.Y + a.Height, b.Y + b.Height); return(new GRect(x1, y1, x2 - x1, y2 - y1)); }
public void Intersect(GRect rect) { GRect result = GRect.Intersect(rect, this); this.X = result.X; this.Y = result.Y; this.Width = result.Width; this.Height = result.Height; }
public static GRect Intersect(GRect a, GRect b) { long x1 = Math.Max(a.X, b.X); long x2 = Math.Min(a.X + a.Width, b.X + b.Width); long y1 = Math.Max(a.Y, b.Y); long y2 = Math.Min(a.Y + a.Height, b.Y + b.Height); if (x2 >= x1 && y2 >= y1) { return(new GRect(x1, y1, x2 - x1, y2 - y1)); } return(GRect.Empty); }
public override bool Equals(object obj) { if (!(obj is GRect)) { return(false); } GRect comp = (GRect)obj; return((comp.X == this.X) && (comp.Y == this.Y) && (comp.Width == this.Width) && (comp.Height == this.Height)); }