# Box

Class Box represents bounding box of the shape. It may also represent axis-aligned rectangle

## Constructor

#### new Box(xmin, ymin, xmax, ymax)

Source:
  - classes/box.js, line 15

##### Parameters:

Name | Type | Description
--- | --- | ---
`xmin` | `number` | minimal x coordinate
`ymin` | `number` | minimal y coordinate
`xmax` | `number` | maximal x coordinate
`ymax` | `number` | maximal y coordinate

### Classes

Box

### Members

#### box

Return property box like all other shapes

Source:
  - classes/box.js, line 107

#### center

Return center of the box

Source:
  - classes/box.js, line 83

#### height

Return the height of the box

Source:
  - classes/box.js, line 99

#### high

Property high need for interval tree interface

Source:
  - classes/box.js, line 67

#### low

Property low need for interval tree interface

Source:
  - classes/box.js, line 59

#### max

Property max returns the box itself !

Source:
  - classes/box.js, line 75

#### width

Return the width of the box

Source:
  - classes/box.js, line 91

#### xmax :number

Maximal x coordinate

Source:
  - classes/box.js, line 39

##### Type:

- `number`

#### xmin :number

Minimal x coordinate

Source:
  - classes/box.js, line 29

##### Type:

- `number`

#### ymax :number

Maximal y coordinate

Source:
  - classes/box.js, line 44

##### Type:

- `number`

#### ymin :number

Minimal y coordinate

Source:
  - classes/box.js, line 34

##### Type:

- `number`

### Methods

#### clone() → {Box}

Return new cloned instance of box

Source:
  - classes/box.js, line 51

##### Returns:

Type:
  `Box`

#### equal_to(other_box) → {boolean}

Returns true if this box is equal to other box, false otherwise

Source:
  - classes/box.js, line 166

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_box` | `Box` | query box

##### Returns:

Type:
  `boolean`

#### intersect(other_box) → {boolean}

Returns true if intersected with other box

Source:
  - classes/box.js, line 130

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_box` | `Box` | Query box

##### Returns:

Type:
  `boolean`

#### less_than(other_box) → {boolean}

Defines predicate "less than" between two boxes. Need for interval index

Source:
  - classes/box.js, line 153

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_box` | `Box` | other box

##### Returns:

Type:
  `boolean`

- true if this box less than other box, false otherwise

#### merge(other_box) → {Box}

Returns new box merged with other box

Source:
  - classes/box.js, line 139

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_box` | `Box` | Other box to merge with

##### Returns:

Type:
  `Box`

#### not_intersect(other_box) → {boolean}

Returns true if not intersected with other box

Source:
  - classes/box.js, line 116

##### Parameters:

Name | Type | Description
--- | --- | ---
`other_box` | `Box` | other box to test

##### Returns:

Type:
  `boolean`

#### rotate(angle, centeropt)

Box rotation is not supported Attempt to rotate box throws error

Source:
  - classes/box.js, line 230

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`angle` | `number` |  |  | angle in radians
`center` | `Point` | <optional> | (0,0) | center

#### set(xmin, ymin, xmax, ymax)

Set new values to the box object

Source:
  - classes/box.js, line 190

##### Parameters:

Name | Type | Description
--- | --- | ---
`xmin` | `number` | mininal x coordinate
`ymin` | `number` | minimal y coordinate
`xmax` | `number` | maximal x coordinate
`ymax` | `number` | maximal y coordinate

#### svg(attrs) → {string}

Return string to draw box in svg

Source:
  - classes/box.js, line 255

##### Parameters:

Name | Type | Description
--- | --- | ---
`attrs` | `Object` | an object with attributes of svg rectangle element

##### Returns:

Type:
  `string`

#### toPoints() → {Array.<Point>}

Transform box into array of points from low left corner in counterclockwise

Source:
  - classes/box.js, line 201

##### Returns:

Type:
  `Array.<Point>`

#### toSegments() → {Array.<Segment>}

Transform box into array of segments from low left corner in counterclockwise

Source:
  - classes/box.js, line 214

##### Returns:

Type:
  `Array.<Segment>`

#### transform(m) → {Box}

Return new box transformed using affine transformation matrix New box is a bounding box of transformed corner points

Source:
  - classes/box.js, line 240

##### Parameters:

Name | Type | Description
--- | --- | ---
`m` | `Matrix` | affine transformation matrix

##### Returns:

Type:
  `Box`