---
title: Rect
description: Structure representing a rectangle.
---

Structure representing a rectangle.

The structure has a width, height and a coordinate in a two-dimensional coordinate system.

## Properties

### height

Height of rectangle.

```typescript
height: number
```

The height of the rectangle.

### maxX

Maximum X value.

```typescript
maxX: number
```

The greatest x-coordinate in the rectangle.

Read-only.

### maxY

Maximum Y value.

```typescript
maxY: number
```

The greatest y-coordinate in the rectangle.

Read-only.

### minX

Minimum X value.

```typescript
minX: number
```

The smallest x-coordinate in the rectangle.

Read-only.

### minY

Minimum Y value.

```typescript
minY: number
```

The smallest y-coordinate in the rectangle.

Read-only.

### origin

Point that specifies the rectangles origin.

```typescript
origin: Point
```

The x- and y-coordinate that specifies the rectangles origin as a Point structure.

### size

Size of the rectangle.

```typescript
size: Size
```

The width and height of the rectangle as a Size structure.

### width

Width of rectangle.

```typescript
width: number
```

The width of the rectangle.

### x

X value.

```typescript
x: number
```

The x-coordinate of the rectangle.

### y

Y value.

```typescript
y: number
```

The y-coordinate of the rectangle.

## Methods

<span id="-new-rect" class="api-anchor"></span>

### new Rect(x, y, width, height)

Constructs a rectangle.

```typescript
new Rect(x: number, y: number, width: number, height: number)
```

Constructs a new rectangle placed in a two-dimensional coordinate system.

#### Parameters

**`x` `number`**

X coordinate.

**`y` `number`**

Y coordinate.

**`width` `number`**

Width of rectangle.

**`height` `number`**

Height of rectangle.