public bool IntersectsWith(RectangleF rect) { return (rect.X < X + Width) && (X < rect.X + rect.Width) && (rect.Y < Y + Height) && (Y < rect.Y + rect.Height); }
public void Intersect(RectangleF rect) { var result = Intersect(rect, this); X = result.X; Y = result.Y; Width = result.Width; Height = result.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 bool Contains(RectangleF rect) { return (X <= rect.X) && (rect.X + rect.Width <= X + Width) && (Y <= rect.Y) && (rect.Y + rect.Height <= Y + Height); }
public static RectangleF Intersect(RectangleF a, RectangleF b) { var x1 = Math.Max(a.X, b.X); var x2 = Math.Min(a.X + a.Width, b.X + b.Width); var y1 = Math.Max(a.Y, b.Y); var 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 Empty; }
public static RectangleF Inflate(RectangleF rect, float x, float y) { var r = rect; r.Inflate(x, y); return r; }
public override void Update(GameTime gameTime) { base.Update(gameTime); Bounds = new RectangleF((Offset.X + Entity.Transform.Position.X), (Offset.Y + Entity.Transform.Position.Y), width, height); }
public override void OnInitialize() { base.OnInitialize(); Bounds = new RectangleF((Offset.X + Entity.Transform.Position.X), (Offset.Y + Entity.Transform.Position.Y), width, height); }