# dsfml.graphics.rect

- struct
__Rect__(T) if (isNumeric!T); - Utility class for manipulating 2D axis aligned rectangles.

A rectangle is defined by its top-left corner and its size.

It is a very simple class defined for convenience, so its member variables (left, top, width and height) are public and can be accessed directly, just like the vector classes (Vector2 and Vector3).

To keep things simple,__Rect__doesn't define functions to emulate the properties that are not directly members (such as right, bottom, center, etc.), it rather only provides intersection functions.

__Rect__uses the usual rules for its boundaries: - The let and top edges are included in the rectangle's area - The right (left + width) and bottom (top + height) edges are excluded from the rectangle's area

This means that IntRect(0, 0, 1, 1) and IntRect(1, 1, 1, 1) don't intersect.

__Rect__is a template and may be used with any numeric type, but for simplicity the instanciations used by SFML are typedefed: -__Rect__!(int) is IntRect -__Rect__!(float) is FloatRect

So that you don't have to care about the template syntax.

**Authors:**

Laurent Gomila, Jeremy DeHaan

**See Also:**

**http:**

//www.sfml-dev.org/documentation/2.0/classsf_1_1Rect.php#details

- T
__left__; - Left coordinate of the rectangle.

- T
__top__; - Top coordinate of the rectangle.

- T
__width__; - Width of the rectangle.

- T
__height__; - HEight of the rectangle.

- const bool
__contains__(E)(E*X*, E*Y*) if (isNumeric!E); - Check if a point is inside the rectangle's area.

**Params:**

x X coordinate of the point to test y Y coordinate of the point to test

**Returns:**

True if the point is inside,**false**otherwise.

- const bool
__contains__(E)(Vector2!E*point*) if (isNumeric!E); - Check if a point is inside the rectangle's area.

**Params:**

Vector2!E point Point to test

**Returns:**

True if the point is inside,**false**otherwise.

- const bool
__intersects__(E)(Rect!E*rectangle*) if (isNumeric!E); - Check the intersection between two rectangles.

**Params:**

Rect!E rectangle Rectangle to test

**Returns:**

True if rectangles overlap,**false**otherwise.

- const bool
__intersects__(E, O)(Rect!E*rectangle*, out Rect!O*intersection*) if (isNumeric!E && isNumeric!O); - Check the intersection between two rectangles.

This overload returns the overlapped rectangle in the intersection parameter.

**Params:**

Rect!E rectangle Rectangle to test Rect!O intersection Rectangle to be filled with the intersection

**Returns:**

True if rectangles overlap,**false**otherwise.

- T