# Class Rect

#### Hierarchy

- Box
  - Rect

#### Implements

- IRect

- Defined in classes/Rect.ts:10

#####
Index

### Constructors

constructor

### Accessors

area
bottom
bottomLeft
bottomRight
height
left
right
top
topLeft
topRight
width
x
y

### Methods

calibrate
clipAtImageBorders
floor
pad
padAtBorders
rescale
round
shift
toSquare
assertIsValidBox
isRect

## Constructors

### constructor

- new Rect(x: number, y: number, width: number, height: number, allowNegativeDimensions?: boolean): Rect

- #### Parameters

  - ##### x: number

  - ##### y: number

  - ##### width: number

  - ##### height: number

  - ##### allowNegativeDimensions: boolean = false

  #### Returns Rect

  Overrides Box.constructor

  - Defined in classes/Rect.ts:11

## Accessors

### area

- get area(): number

- #### Returns number

  Inherited from Box.area

  - Defined in classes/Box.ts:70

### bottom

- get bottom(): number

- #### Returns number

  Inherited from Box.bottom

  - Defined in classes/Box.ts:68

### bottomLeft

- get bottomLeft(): Point

- #### Returns Point

  Inherited from Box.bottomLeft

  - Defined in classes/Box.ts:76

### bottomRight

- get bottomRight(): Point

- #### Returns Point

  Inherited from Box.bottomRight

  - Defined in classes/Box.ts:78

### height

- get height(): number

- #### Returns number

  Implementation of IRect.height

  Inherited from Box.height

  - Defined in classes/Box.ts:60

### left

- get left(): number

- #### Returns number

  Inherited from Box.left

  - Defined in classes/Box.ts:62

### right

- get right(): number

- #### Returns number

  Inherited from Box.right

  - Defined in classes/Box.ts:66

### top

- get top(): number

- #### Returns number

  Inherited from Box.top

  - Defined in classes/Box.ts:64

### topLeft

- get topLeft(): Point

- #### Returns Point

  Inherited from Box.topLeft

  - Defined in classes/Box.ts:72

### topRight

- get topRight(): Point

- #### Returns Point

  Inherited from Box.topRight

  - Defined in classes/Box.ts:74

### width

- get width(): number

- #### Returns number

  Implementation of IRect.width

  Inherited from Box.width

  - Defined in classes/Box.ts:58

### x

- get x(): number

- #### Returns number

  Implementation of IRect.x

  Inherited from Box.x

  - Defined in classes/Box.ts:54

### y

- get y(): number

- #### Returns number

  Implementation of IRect.y

  Inherited from Box.y

  - Defined in classes/Box.ts:56

## Methods

### calibrate

- calibrate(region: Box<any>): Box<any>

- #### Parameters

  - ##### region: Box<any>

  #### Returns Box<any>

  Inherited from Box.calibrate

  - Defined in classes/Box.ts:189

### clipAtImageBorders

- clipAtImageBorders(imgWidth: number, imgHeight: number): Box<any>

- #### Parameters

  - ##### imgWidth: number

  - ##### imgHeight: number

  #### Returns Box<any>

  Inherited from Box.clipAtImageBorders

  - Defined in classes/Box.ts:134

### floor

- floor(): Box<any>

- #### Returns Box<any>

  Inherited from Box.floor

  - Defined in classes/Box.ts:88

### pad

- pad(padX: number, padY: number): Box<any>

- #### Parameters

  - ##### padX: number

  - ##### padY: number

  #### Returns Box<any>

  Inherited from Box.pad

  - Defined in classes/Box.ts:124

### padAtBorders

- padAtBorders(imageHeight: number, imageWidth: number): { dx: number; dy: number; edx: number; edy: number; ex: number; ey: number; h: number; w: number; x: number; y: number }

- #### Parameters

  - ##### imageHeight: number

  - ##### imageWidth: number

  #### Returns { dx: number; dy: number; edx: number; edy: number; ex: number; ey: number; h: number; w: number; x: number; y: number }

  - ##### dx: number

  - ##### dy: number

  - ##### edx: number

  - ##### edy: number

  - ##### ex: number

  - ##### ey: number

  - ##### h: number

  - ##### w: number

  - ##### x: number

  - ##### y: number

  Inherited from Box.padAtBorders

  - Defined in classes/Box.ts:155

### rescale

- rescale(s: number | IDimensions): Box<any>

- #### Parameters

  - ##### s: number | IDimensions

  #### Returns Box<any>

  Inherited from Box.rescale

  - Defined in classes/Box.ts:113

### round

- round(): Box<any>

- #### Returns Box<any>

  Inherited from Box.round

  - Defined in classes/Box.ts:80

### shift

- shift(sx: number, sy: number): Box<any>

- #### Parameters

  - ##### sx: number

  - ##### sy: number

  #### Returns Box<any>

  Inherited from Box.shift

  - Defined in classes/Box.ts:147

### toSquare

- toSquare(): Box<any>

- #### Returns Box<any>

  Inherited from Box.toSquare

  - Defined in classes/Box.ts:96

### `Static` assertIsValidBox

- assertIsValidBox(box: any, callee: string, allowNegativeDimensions?: boolean): void

- #### Parameters

  - ##### box: any

  - ##### callee: string

  - ##### allowNegativeDimensions: boolean = false

  #### Returns void

  Inherited from Box.assertIsValidBox

  - Defined in classes/Box.ts:12

### `Static` isRect

- isRect(rect: any): boolean

- #### Parameters

  - ##### rect: any

  #### Returns boolean

  Inherited from Box.isRect

  - Defined in classes/Box.ts:8