# GC.Spread.Sheets.Rect

## Content

# Class: Rect

[Spread](../modules/GC.Spread).[Sheets](../modules/GC.Spread.Sheets).Rect

## Table of contents

### Constructors

- [constructor](GC.Spread.Sheets.Rect#constructor)

### Properties

- [height](GC.Spread.Sheets.Rect#height)
- [width](GC.Spread.Sheets.Rect#width)
- [x](GC.Spread.Sheets.Rect#x)
- [y](GC.Spread.Sheets.Rect#y)

### Methods

- [contains](GC.Spread.Sheets.Rect#contains)
- [getIntersectRect](GC.Spread.Sheets.Rect#getintersectrect)
- [intersect](GC.Spread.Sheets.Rect#intersect)
- [intersectRect](GC.Spread.Sheets.Rect#intersectrect)

## Constructors

### <a id="constructor" name="constructor"></a> constructor

• **new Rect**(`x`, `y`, `w`, `h`)

Represents a rectangle with a special location, and its width and height in two-dimensional space.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `x` | `number` | The <i>x</i>-coordinate of the top-left corner of the rectangle. |
| `y` | `number` | The <i>y</i>-coordinate of the top-left corner of the rectangle. |
| `w` | `number` | The width of the rectangle. |
| `h` | `number` | The height of the rectangle. |

## Properties

### <a id="height" name="height"></a> height

• **height**: `number`

The width of the rectangle.

___

### <a id="width" name="width"></a> width

• **width**: `number`

The height of the rectangle.

___

### <a id="x" name="x"></a> x

• **x**: `number`

The <i>x</i>-coordinate of the top-left corner of the rectangle.

___

### <a id="y" name="y"></a> y

• **y**: `number`

The <i>y</i>-coordinate of the top-left corner of the rectangle.

## Methods

### <a id="contains" name="contains"></a> contains

▸ **contains**(`x`, `y`): `boolean`

Indicates whether the rectangle contains the specified <i>x</i>-coordinate and <i>y</i>-coordinate.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `x` | `number` | The <i>x</i>-coordinate of the point to check. |
| `y` | `number` | The <i>y</i>-coordinate of the point to check. |

#### Returns

`boolean`

`true` if (x, y) is contained by the rectangle; otherwise, `false`.

___

### <a id="getintersectrect" name="getintersectrect"></a> getIntersectRect

▸ **getIntersectRect**(`rect`): [`Rect`](GC.Spread.Sheets.Rect)

Gets the rectangle that intersects with the current rectangle.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `rect` | [`Rect`](GC.Spread.Sheets.Rect) | The rectangle. |

#### Returns

[`Rect`](GC.Spread.Sheets.Rect)

The intersecting rectangle. If the two rectangles do not intersect, returns null.

___

### <a id="intersect" name="intersect"></a> intersect

▸ **intersect**(`x`, `y`, `width`, `height`): `boolean`

Indicates whether the specified rectangle intersects with the current rectangle.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `x` | `number` | The <i>x</i>-coordinate of the top-left corner of the rectangle. |
| `y` | `number` | The <i>y</i>-coordinate of the top-left corner of the rectangle. |
| `width` | `number` | The width of the rectangle. |
| `height` | `number` | The height of the rectangle. |

#### Returns

`boolean`

`true` if the specified rectangle intersects with the current rectangle; otherwise, `false`.

___

### <a id="intersectrect" name="intersectrect"></a> intersectRect

▸ **intersectRect**(`rect`): `boolean`

Indicates whether the specified rectangle intersects with the current rectangle.

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `rect` | [`Rect`](GC.Spread.Sheets.Rect) | The specified rectangle. |

#### Returns

`boolean`

`true` if the specified rectangle intersects with the current rectangle; otherwise, `false`.
