# BoundingRectangle

#### new Cesium.BoundingRectangle(x, y, width, height)
engine/Source/Core/BoundingRectangle.js 23

A bounding rectangle given by a corner, width and height.

Name | Type | Default | Description
--- | --- | --- | ---
`x` | number | `0.0` | optional The x coordinate of the rectangle.
`y` | number | `0.0` | optional The y coordinate of the rectangle.
`width` | number | `0.0` | optional The width of the rectangle.
`height` | number | `0.0` | optional The height of the rectangle.

##### See:

- BoundingSphere
- Packable

### Members

#### static Cesium.BoundingRectangle.packedLength : number
engine/Source/Core/BoundingRectangle.js 57

The number of elements used to pack the object into an array.

#### height : number
engine/Source/Core/BoundingRectangle.js 50

The height of the rectangle.

Default Value: `0.0`

#### width : number
engine/Source/Core/BoundingRectangle.js 43

The width of the rectangle.

Default Value: `0.0`

#### x : number
engine/Source/Core/BoundingRectangle.js 29

The x coordinate of the rectangle.

Default Value: `0.0`

#### y : number
engine/Source/Core/BoundingRectangle.js 36

The y coordinate of the rectangle.

Default Value: `0.0`

### Methods

#### static Cesium.BoundingRectangle.clone(rectangle, result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 206

Duplicates a BoundingRectangle instance.

Name | Type | Description
--- | --- | ---
`rectangle` | BoundingRectangle | The bounding rectangle to duplicate.
`result` | BoundingRectangle | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided. (Returns undefined if rectangle is undefined)

#### static Cesium.BoundingRectangle.equals(left, right) → boolean
engine/Source/Core/BoundingRectangle.js 332

Compares the provided BoundingRectangles componentwise and returns `true` if they are equal, `false` otherwise.

Name | Type | Description
--- | --- | ---
`left` | BoundingRectangle | optional The first BoundingRectangle.
`right` | BoundingRectangle | optional The second BoundingRectangle.

##### Returns:

`true` if left and right are equal, `false` otherwise.

#### static Cesium.BoundingRectangle.expand(rectangle, point, result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 265

Computes a bounding rectangle by enlarging the provided rectangle until it contains the provided point.

Name | Type | Description
--- | --- | ---
`rectangle` | BoundingRectangle | A rectangle to expand.
`point` | Cartesian2 | A point to enclose in a bounding rectangle.
`result` | BoundingRectangle | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided.

#### static Cesium.BoundingRectangle.fromPoints(positions, result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 117

Computes a bounding rectangle enclosing the list of 2D points. The rectangle is oriented with the corner at the bottom left.

Name | Type | Description
--- | --- | ---
`positions` | Array.<Cartesian2> | List of points that the bounding rectangle will enclose. Each point must have `x` and `y` properties.
`result` | BoundingRectangle | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided.

#### static Cesium.BoundingRectangle.fromRectangle(rectangle, projection, result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 167

Computes a bounding rectangle from a rectangle.

Name | Type | Default | Description
--- | --- | --- | ---
`rectangle` | Rectangle |  | The valid rectangle used to create a bounding rectangle.
`projection` | object | `GeographicProjection` | optional The projection used to project the rectangle into 2D.
`result` | BoundingRectangle |  | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided.

#### static Cesium.BoundingRectangle.intersect(left, right) → Intersect
engine/Source/Core/BoundingRectangle.js 300

Determines if two rectangles intersect.

Name | Type | Description
--- | --- | ---
`left` | BoundingRectangle | A rectangle to check for intersection.
`right` | BoundingRectangle | The other rectangle to check for intersection.

##### Returns:

`Intersect.INTERSECTING` if the rectangles intersect, `Intersect.OUTSIDE` otherwise.

#### static Cesium.BoundingRectangle.pack(value, array, startingIndex) → Array.<number>
engine/Source/Core/BoundingRectangle.js 68

Stores the provided instance into the provided array.

Name | Type | Default | Description
--- | --- | --- | ---
`value` | BoundingRectangle |  | The value to pack.
`array` | Array.<number> |  | The array to pack into.
`startingIndex` | number | `0` | optional The index into the array at which to start packing the elements.

##### Returns:

The array that was packed into

#### static Cesium.BoundingRectangle.union(left, right, result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 235

Computes a bounding rectangle that is the union of the left and right bounding rectangles.

Name | Type | Description
--- | --- | ---
`left` | BoundingRectangle | A rectangle to enclose in bounding rectangle.
`right` | BoundingRectangle | A rectangle to enclose in a bounding rectangle.
`result` | BoundingRectangle | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided.

#### static Cesium.BoundingRectangle.unpack(array, startingIndex, result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 92

Retrieves an instance from a packed array.

Name | Type | Default | Description
--- | --- | --- | ---
`array` | Array.<number> |  | The packed array.
`startingIndex` | number | `0` | optional The starting index of the element to be unpacked.
`result` | BoundingRectangle |  | optional The object into which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided.

#### clone(result) → BoundingRectangle
engine/Source/Core/BoundingRectangle.js 350

Duplicates this BoundingRectangle instance.

Name | Type | Description
--- | --- | ---
`result` | BoundingRectangle | optional The object onto which to store the result.

##### Returns:

The modified result parameter or a new BoundingRectangle instance if one was not provided.

#### equals(right) → boolean
engine/Source/Core/BoundingRectangle.js 371

Compares this BoundingRectangle against the provided BoundingRectangle componentwise and returns `true` if they are equal, `false` otherwise.

Name | Type | Description
--- | --- | ---
`right` | BoundingRectangle | optional The right hand side BoundingRectangle.

##### Returns:

`true` if they are equal, `false` otherwise.

#### intersect(right) → Intersect
engine/Source/Core/BoundingRectangle.js 360

Determines if this rectangle intersects with another.

Name | Type | Description
--- | --- | ---
`right` | BoundingRectangle | A rectangle to check for intersection.

##### Returns:

`Intersect.INTERSECTING` if the rectangles intersect, `Intersect.OUTSIDE` otherwise.

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.