OpenTK.Graphics.Rectangle.Intersect C# (CSharp) Method

Intersect() public static method

Intersect Shared Method
Produces a new Rectangle by intersecting 2 existing Rectangles. Returns null if there is no intersection.
public static Intersect ( Rectangle a, Rectangle b ) : Rectangle
a Rectangle
b Rectangle
return Rectangle
        public static Rectangle Intersect(Rectangle a, Rectangle b)
        {
            // MS.NET returns a non-empty rectangle if the two rectangles
            // touch each other
            if (!a.IntersectsWithInclusive(b))
                return Empty;
            return Rectangle.FromLTRB(
                Math.Max(a.Left, b.Left),
                Math.Max(a.Top, b.Top),
                Math.Min(a.Right, b.Right),
                Math.Min(a.Bottom, b.Bottom));
        }

Same methods

Rectangle::Intersect ( Rectangle rect ) : void