Nez.Portable/Math/RectangleF.cs
/// <summary>
/// Creates a new <see cref="RectangleF"/> that contains overlapping region of two other rectangles.
/// </summary>
/// <param name="value1">The first <see cref="RectangleF"/>.</param>
/// <param name="value2">The second <see cref="RectangleF"/>.</param>
/// <param name="result">Overlapping region of the two rectangles as an output parameter.</param>
Creates a new  that contains overlapping region of two other rectangles.
Creates a new that contains overlapping region of two other rectangles .
public static void intersect(ref RectangleF value1, ref RectangleF value2, out RectangleF result)
        {
            if (value1.intersects(value2))
            {
                var right_side = Math.Min(value1.x + value1.width, value2.x + value2.width);
                var left_side = Math.Max(value1.x, value2.x);
                var top_side = Math.Max(value1.y, value2.y);
                var 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 ) ) { var right_side = Math . Min ( value1 . x + value1 . width , value2 . x + value2 . width ) ; var left_side = Math . Max ( value1 . x , value2 . x ) ; var top_side = Math . Max ( value1 . y , value2 . y ) ; var 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 ) ; } }
Creates a new  that contains overlapping region of two other rectangles.
Creates a new that contains overlapping region of two other rectangles .
RectangleF
out
value1
The first .
The first .
value2
The second .
The second .
result
Overlapping region of the two rectangles as an output parameter.
Overlapping region of the two rectangles as an output parameter .