# Rectangle

#### new Rectangle()

A utility for creating and comparing axis-aligned rectangles. Rectangles are always initialized to the "largest possible rectangle"; use one of the init* methods below to set up a particular rectangle.

### Members

#### height

Height of the Rectangle.

#### width

Width of the Rectangle.

### Methods

#### clamp(left, right, bottom, top)

Clamp a Rectangle to bounds.

##### Parameters:

Name | Type | Description
--- | --- | ---
`left` | number | Left clamp.
`right` | number | Right clamp.
`bottom` | number | Bottom clamp.
`top` | number | Top clamp.

#### contains(othernon-null) → {boolean}

Determine if this Rectangle fully contains some other. Note that this is a comparison assuming the Rectangle was initialized with Scratch-space bounds or points.

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | Rectangle | Rectangle to check if fully contained.

##### Returns:

True if this Rectangle fully contains other.

Type
  boolean

#### initFromBounds(left, right, bottom, top)

Initialize a Rectangle from given Scratch-coordinate bounds.

##### Parameters:

Name | Type | Description
--- | --- | ---
`left` | number | Left bound of the rectangle.
`right` | number | Right bound of the rectangle.
`bottom` | number | Bottom bound of the rectangle.
`top` | number | Top bound of the rectangle.

#### initFromPointsAABB(points)

Initialize a Rectangle to the minimum AABB around a set of points.

##### Parameters:

Name | Type | Description
--- | --- | ---
`points` | Array.<Array.<number>> | Array of [x, y] points.

#### intersects(othernon-null) → {boolean}

Determine if this Rectangle intersects some other. Note that this is a comparison assuming the Rectangle was initialized with Scratch-space bounds or points.

##### Parameters:

Name | Type | Description
--- | --- | ---
`other` | Rectangle | Rectangle to check if intersecting.

##### Returns:

True if this Rectangle intersects other.

Type
  boolean

#### snapToInt()

Push out the Rectangle to integer bounds.