public Intersects ( |
||
value | ||
Результат | bool |
public static void Intersect(ref RectangleF value1, ref RectangleF value2, out RectangleF result) { if (value1.Intersects(value2)) { float right_side = Math.Min(value1.X + value1.Width, value2.X + value2.Width); float left_side = Math.Max(value1.X, value2.X); float top_side = Math.Max(value1.Y, value2.Y); float bottom_side = Math.Min(value1.Y + value1.Height, value2.Y + value2.Height); result = new RectangleF(left_side, top_side, right_side - left_side, bottom_side - top_side); } else { result = new RectangleF(0, 0, 0, 0); } }
public static void Intersect(ref RectangleF value1, ref RectangleF value2, out RectangleF result) { if (value1.Intersects(value2)) { float right_side = Math.Min(value1.X + value1.Width, value2.X + value2.Width); float left_side = Math.Max(value1.X, value2.X); float top_side = Math.Max(value1.Y, value2.Y); float bottom_side = Math.Min(value1.Y + value1.Height, value2.Y + value2.Height); result = new RectangleF(left_side, top_side, right_side - left_side, bottom_side - top_side); } else { result = new RectangleF(0, 0, 0, 0); } }