# Rectangle

#### new Cesium.Rectangle(west, south, east, north)
Core/Rectangle.js 35

  A two dimensional region specified as longitude and latitude coordinates.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `west` | Number | `0.0` | optional The westernmost longitude, in radians, in the range [-Pi, Pi].
  `south` | Number | `0.0` | optional The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
  `east` | Number | `0.0` | optional The easternmost longitude, in radians, in the range [-Pi, Pi].
  `north` | Number | `0.0` | optional The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].

  ##### See:

  - Packable

### Members

#### static constantCesium.Rectangle.MAX_VALUE : Rectangle
Core/Rectangle.js 719

  The largest possible rectangle.

#### staticCesium.Rectangle.packedLength : Number
Core/Rectangle.js 97

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

#### east : Number
Core/Rectangle.js 58

  The easternmost longitude in radians in the range [-Pi, Pi].
  Default Value: `0.0`

#### height : Number
Core/Rectangle.js 86

  Gets the height of the rectangle in radians.

#### north : Number
Core/Rectangle.js 66

  The northernmost latitude in radians in the range [-Pi/2, Pi/2].
  Default Value: `0.0`

#### south : Number
Core/Rectangle.js 50

  The southernmost latitude in radians in the range [-Pi/2, Pi/2].
  Default Value: `0.0`

#### west : Number
Core/Rectangle.js 42

  The westernmost longitude in radians in the range [-Pi, Pi].
  Default Value: `0.0`

#### width : Number
Core/Rectangle.js 75

  Gets the width of the rectangle in radians.

### Methods

#### staticCesium.Rectangle.center(rectangle, result) → Cartographic
Core/Rectangle.js 511

  Computes the center of an rectangle.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle for which to find the center
  `result` | Cartographic | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartographic instance if none was provided.

#### staticCesium.Rectangle.clone(rectangle, result) → Rectangle
Core/Rectangle.js 280

  Duplicates an Rectangle.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle to clone.
  `result` | Rectangle | optional The object onto which to store the result, or undefined if a new instance should be created.

  ##### Returns:

  The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)

#### staticCesium.Rectangle.computeHeight(rectangle) → Number
Core/Rectangle.js 177

  Computes the height of a rectangle in radians.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle to compute the height of.

  ##### Returns:

  The height.

#### staticCesium.Rectangle.computeWidth(rectangle) → Number
Core/Rectangle.js 158

  Computes the width of a rectangle in radians.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle to compute the width of.

  ##### Returns:

  The width.

#### staticCesium.Rectangle.contains(rectangle, cartographic) → Boolean
Core/Rectangle.js 605

  Returns true if the cartographic is on or inside the rectangle, false otherwise.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle
  `cartographic` | Cartographic | The cartographic to test.

  ##### Returns:

  true if the provided cartographic is inside the rectangle, false otherwise.

#### staticCesium.Rectangle.equals(left, right) → Boolean
Core/Rectangle.js 325

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

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

  ##### Returns:

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

#### staticCesium.Rectangle.fromCartographicArray(cartographics, result) → Rectangle
Core/Rectangle.js 224

  Creates the smallest possible Rectangle that encloses all positions in the provided array.

  Name | Type | Description
  --- | --- | ---
  `cartographics` | Array.<Cartographic> | The list of Cartographic instances.
  `result` | Rectangle | optional The object onto which to store the result, or undefined if a new instance should be created.

  ##### Returns:

  The modified result parameter or a new Rectangle instance if none was provided.

#### staticCesium.Rectangle.fromDegrees(west, south, east, north, result) → Rectangle
Core/Rectangle.js 199

  Creates an rectangle given the boundary longitude and latitude in degrees.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `west` | Number | `0.0` | optional The westernmost longitude in degrees in the range [-180.0, 180.0].
  `south` | Number | `0.0` | optional The southernmost latitude in degrees in the range [-90.0, 90.0].
  `east` | Number | `0.0` | optional The easternmost longitude in degrees in the range [-180.0, 180.0].
  `north` | Number | `0.0` | optional The northernmost latitude in degrees in the range [-90.0, 90.0].
  `result` | Rectangle |  | optional The object onto which to store the result, or undefined if a new instance should be created.

  ##### Returns:

  The modified result parameter or a new Rectangle instance if none was provided.

  ##### Example:

      var rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);

#### staticCesium.Rectangle.intersection(rectangle, otherRectangle, result) → Rectangle|undefined
Core/Rectangle.js 546

  Computes the intersection of two rectangles

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | On rectangle to find an intersection
  `otherRectangle` | Rectangle | Another rectangle to find an intersection
  `result` | Rectangle | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.

#### staticCesium.Rectangle.northeast(rectangle, result) → Cartographic
Core/Rectangle.js 465

  Computes the northeast corner of an rectangle.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle for which to find the corner
  `result` | Cartographic | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartographic instance if none was provided.

#### staticCesium.Rectangle.northwest(rectangle, result) → Cartographic
Core/Rectangle.js 442

  Computes the northwest corner of an rectangle.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle for which to find the corner
  `result` | Cartographic | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartographic instance if none was provided.

#### staticCesium.Rectangle.pack(value, array, startingIndex)
Core/Rectangle.js 106

  Stores the provided instance into the provided array.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `value` | Rectangle |  | 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.

#### staticCesium.Rectangle.southeast(rectangle, result) → Cartographic
Core/Rectangle.js 488

  Computes the southeast corner of an rectangle.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle for which to find the corner
  `result` | Cartographic | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartographic instance if none was provided.

#### staticCesium.Rectangle.southwest(rectangle, result) → Cartographic
Core/Rectangle.js 419

  Computes the southwest corner of an rectangle.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle for which to find the corner
  `result` | Cartographic | optional The object onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Cartographic instance if none was provided.

#### staticCesium.Rectangle.subsample(rectangle, ellipsoid, surfaceHeight, result) → Array.<Cartesian3>
Core/Rectangle.js 645

  Samples an rectangle so that it includes a list of Cartesian points suitable for passing to `BoundingSphere#fromPoints`. Sampling is necessary to account for rectangles that cover the poles or cross the equator.

  Name | Type | Default | Description
  --- | --- | --- | ---
  `rectangle` | Rectangle |  | The rectangle to subsample.
  `ellipsoid` | Ellipsoid | `Ellipsoid.WGS84` | optional The ellipsoid to use.
  `surfaceHeight` | Number | `0.0` | optional The height of the rectangle above the ellipsoid.
  `result` | Array.<Cartesian3> |  | optional The array of Cartesians onto which to store the result.

  ##### Returns:

  The modified result parameter or a new Array of Cartesians instances if none was provided.

#### staticCesium.Rectangle.unpack(array, startingIndex, result) → Rectangle
Core/Rectangle.js 133

  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` | Rectangle |  | optional The object into which to store the result.

  ##### Returns:

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

#### staticCesium.Rectangle.validate(rectangle)
Core/Rectangle.js 368

  Checks an Rectangle's properties and throws if they are not in valid ranges.

  Name | Type | Description
  --- | --- | ---
  `rectangle` | Rectangle | The rectangle to validate

  ##### Throws:

  - DeveloperError : `north` must be in the interval [`-Pi/2`, `Pi/2`].
  - DeveloperError : `south` must be in the interval [`-Pi/2`, `Pi/2`].
  - DeveloperError : `east` must be in the interval [`-Pi`, `Pi`].
  - DeveloperError : `west` must be in the interval [`-Pi`, `Pi`].

#### clone(result) → Rectangle
Core/Rectangle.js 302

  Duplicates this Rectangle.

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

  ##### Returns:

  The modified result parameter or a new Rectangle instance if none was provided.

#### equals(other) → Boolean
Core/Rectangle.js 313

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

  Name | Type | Description
  --- | --- | ---
  `other` | Rectangle | optional The Rectangle to compare.

  ##### Returns:

  `true` if the Rectangles are equal, `false` otherwise.

#### equalsEpsilon(other, epsilon) → Boolean
Core/Rectangle.js 344

  Compares the provided Rectangle with this Rectangle componentwise and returns `true` if they are within the provided epsilon, `false` otherwise.

  Name | Type | Description
  --- | --- | ---
  `other` | Rectangle | optional The Rectangle to compare.
  `epsilon` | Number | The epsilon to use for equality testing.

  ##### Returns:

  `true` if the Rectangles are within the provided epsilon, `false` otherwise.