# RectIntersection

int RectIntersection (Rect rect1, Rect rect2, Rect *intersectionRect);

## Purpose

Returns an indication of whether the two rectangles you specify intersect. If they do, the function fills in a Rect structure describing the intersection area.

This function also calculates the largest rectangle that is enclosed by the two specified rectangles.

## Parameters

Input
Name | Type | Description
rect1 | Rect | The location and size of a rectangle.
rect2 | Rect | The location and size of a rectangle.
Output
Name | Type | Description
intersectionRect | Rect | Rect structure that specifies the largest rectangle enclosed by both rect1 and rect2. If rect1 and rect2 do not intersect, this parameter is set to an empty rectangle with height and width less than or equal to zero. You can pass NULL for this parameter.

## Return Value

Name | Type | Description
rectsIntersect | integer | Indicates if rect1 and rect2 intersect, in other words, have any points in common.
Code | Description
1 | rect1 and rect2 intersect.
0 | rect1 and rect2 do not intersect.