public virtual RectBox GetRect() { if (rect == null) { rect = new RectBox(x, y, GetWidth(), GetHeight()); } else { rect.SetBounds(x, y, GetWidth(), GetHeight()); } return(rect); }
public static RectBox GetIntersection(RectBox a, RectBox b, RectBox result) { float a_x = a.GetX(); float a_r = a.GetRight(); float a_y = a.GetY(); float a_t = a.GetBottom(); float b_x = b.GetX(); float b_r = b.GetRight(); float b_y = b.GetY(); float b_t = b.GetBottom(); float i_x = MathUtils.Max(a_x, b_x); float i_r = MathUtils.Min(a_r, b_r); float i_y = MathUtils.Max(a_y, b_y); float i_t = MathUtils.Min(a_t, b_t); if (i_x < i_r && i_y < i_t) { result.SetBounds(i_x, i_y, i_r - i_x, i_t - i_y); return result; } return null; }
public static RectBox GetIntersection(RectBox a, RectBox b, RectBox result) { float a_x = a.GetX(); float a_r = a.GetRight(); float a_y = a.GetY(); float a_t = a.GetBottom(); float b_x = b.GetX(); float b_r = b.GetRight(); float b_y = b.GetY(); float b_t = b.GetBottom(); float i_x = MathUtils.Max(a_x, b_x); float i_r = MathUtils.Min(a_r, b_r); float i_y = MathUtils.Max(a_y, b_y); float i_t = MathUtils.Min(a_t, b_t); if (i_x < i_r && i_y < i_t) { result.SetBounds(i_x, i_y, i_r - i_x, i_t - i_y); return(result); } return(null); }