Class: Rectangle

Rectangle

new Rectangle(westopt, southopt, eastopt, northopt)

A two dimensional region specified as longitude and latitude coordinates.
Parameters:
Name Type Attributes Default Description
west Number <optional>
0.0 The westernmost longitude, in radians, in the range [-Pi, Pi].
south Number <optional>
0.0 The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].
east Number <optional>
0.0 The easternmost longitude, in radians, in the range [-Pi, Pi].
north Number <optional>
0.0 The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].
Source:
See:
  • Packable

Members

(static, constant) MAX_VALUE :Rectangle

The largest possible rectangle.
Type:
Source:

(static) packedLength :Number

The number of elements used to pack the object into an array.
Type:
  • Number
Source:

east :Number

The easternmost longitude in radians in the range [-Pi, Pi].
Type:
  • Number
Default Value:
  • 0.0
Source:

height :Number

Gets the height of the rectangle in radians.
Type:
  • Number
Source:

north :Number

The northernmost latitude in radians in the range [-Pi/2, Pi/2].
Type:
  • Number
Default Value:
  • 0.0
Source:

south :Number

The southernmost latitude in radians in the range [-Pi/2, Pi/2].
Type:
  • Number
Default Value:
  • 0.0
Source:

west :Number

The westernmost longitude in radians in the range [-Pi, Pi].
Type:
  • Number
Default Value:
  • 0.0
Source:

width :Number

Gets the width of the rectangle in radians.
Type:
  • Number
Source:

Methods

(static) center(rectangle, resultopt) → {Cartographic}

Computes the center of an rectangle.
Parameters:
Name Type Attributes Description
rectangle Rectangle The rectangle for which to find the center
result Cartographic <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Cartographic instance if none was provided.
Type
Cartographic

(static) clone(rectangle, resultopt) → {Rectangle}

Duplicates an Rectangle.
Parameters:
Name Type Attributes 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.
Source:
Returns:
The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined)
Type
Rectangle

(static) computeHeight(rectangle) → {Number}

Computes the height of a rectangle in radians.
Parameters:
Name Type Description
rectangle Rectangle The rectangle to compute the height of.
Source:
Returns:
The height.
Type
Number

(static) computeWidth(rectangle) → {Number}

Computes the width of a rectangle in radians.
Parameters:
Name Type Description
rectangle Rectangle The rectangle to compute the width of.
Source:
Returns:
The width.
Type
Number

(static) contains(rectangle, cartographic) → {Boolean}

Returns true if the cartographic is on or inside the rectangle, false otherwise.
Parameters:
Name Type Description
rectangle Rectangle The rectangle
cartographic Cartographic The cartographic to test.
Source:
Returns:
true if the provided cartographic is inside the rectangle, false otherwise.
Type
Boolean

(static) equals(leftopt, rightopt) → {Boolean}

Compares the provided rectangles and returns true if they are equal, false otherwise.
Parameters:
Name Type Attributes Description
left Rectangle <optional>
The first Rectangle.
right Rectangle <optional>
The second Rectangle.
Source:
Returns:
true if left and right are equal; otherwise false.
Type
Boolean

(static) expand(rectangle, cartographic, resultopt) → {Rectangle}

Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.
Parameters:
Name Type Attributes Description
rectangle Rectangle A rectangle to expand.
cartographic Cartographic A cartographic to enclose in a rectangle.
result Rectangle <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Rectangle instance if one was not provided.
Type
Rectangle

(static) fromCartesianArray(cartesians, ellipsoidopt, resultopt) → {Rectangle}

Creates the smallest possible Rectangle that encloses all positions in the provided array.
Parameters:
Name Type Attributes Default Description
cartesians Array.<Cartesian> The list of Cartesian instances.
ellipsoid Ellipsoid <optional>
Ellipsoid.WGS84 The ellipsoid the cartesians are on.
result Rectangle <optional>
The object onto which to store the result, or undefined if a new instance should be created.
Source:
Returns:
The modified result parameter or a new Rectangle instance if none was provided.
Type
Rectangle

(static) fromCartographicArray(cartographics, resultopt) → {Rectangle}

Creates the smallest possible Rectangle that encloses all positions in the provided array.
Parameters:
Name Type Attributes 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.
Source:
Returns:
The modified result parameter or a new Rectangle instance if none was provided.
Type
Rectangle

(static) fromDegrees(westopt, southopt, eastopt, northopt, resultopt) → {Rectangle}

Creates an rectangle given the boundary longitude and latitude in degrees.
Parameters:
Name Type Attributes Default Description
west Number <optional>
0.0 The westernmost longitude in degrees in the range [-180.0, 180.0].
south Number <optional>
0.0 The southernmost latitude in degrees in the range [-90.0, 90.0].
east Number <optional>
0.0 The easternmost longitude in degrees in the range [-180.0, 180.0].
north Number <optional>
0.0 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.
Source:
Returns:
The modified result parameter or a new Rectangle instance if none was provided.
Type
Rectangle
Example
var rectangle = Cesium.Rectangle.fromDegrees(0.0, 20.0, 10.0, 30.0);

(static) intersection(rectangle, otherRectangle, resultopt) → {Rectangle|undefined}

Computes the intersection of two rectangles. This function assumes that the rectangle's coordinates are latitude and longitude in radians and produces a correct intersection, taking into account the fact that the same angle can be represented with multiple values as well as the wrapping of longitude at the anti-meridian. For a simple intersection that ignores these factors and can be used with projected coordinates, see Rectangle.simpleIntersection.
Parameters:
Name Type Attributes 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.
Source:
Returns:
The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
Type
Rectangle | undefined

(static) northeast(rectangle, resultopt) → {Cartographic}

Computes the northeast corner of an rectangle.
Parameters:
Name Type Attributes Description
rectangle Rectangle The rectangle for which to find the corner
result Cartographic <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Cartographic instance if none was provided.
Type
Cartographic

(static) northwest(rectangle, resultopt) → {Cartographic}

Computes the northwest corner of an rectangle.
Parameters:
Name Type Attributes Description
rectangle Rectangle The rectangle for which to find the corner
result Cartographic <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Cartographic instance if none was provided.
Type
Cartographic

(static) pack(value, array, startingIndexopt) → {Array.<Number>}

Stores the provided instance into the provided array.
Parameters:
Name Type Attributes Default Description
value Rectangle The value to pack.
array Array.<Number> The array to pack into.
startingIndex Number <optional>
0 The index into the array at which to start packing the elements.
Source:
Returns:
The array that was packed into
Type
Array.<Number>

(static) simpleIntersection(rectangle, otherRectangle, resultopt) → {Rectangle|undefined}

Computes a simple intersection of two rectangles. Unlike Rectangle.intersection, this function does not attempt to put the angular coordinates into a consistent range or to account for crossing the anti-meridian. As such, it can be used for rectangles where the coordinates are not simply latitude and longitude (i.e. projected coordinates).
Parameters:
Name Type Attributes 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.
Source:
Returns:
The modified result parameter, a new Rectangle instance if none was provided or undefined if there is no intersection.
Type
Rectangle | undefined

(static) southeast(rectangle, resultopt) → {Cartographic}

Computes the southeast corner of an rectangle.
Parameters:
Name Type Attributes Description
rectangle Rectangle The rectangle for which to find the corner
result Cartographic <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Cartographic instance if none was provided.
Type
Cartographic

(static) southwest(rectangle, resultopt) → {Cartographic}

Computes the southwest corner of an rectangle.
Parameters:
Name Type Attributes Description
rectangle Rectangle The rectangle for which to find the corner
result Cartographic <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Cartographic instance if none was provided.
Type
Cartographic

(static) subsample(rectangle, ellipsoidopt, surfaceHeightopt, resultopt) → {Array.<Cartesian3>}

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.
Parameters:
Name Type Attributes Default Description
rectangle Rectangle The rectangle to subsample.
ellipsoid Ellipsoid <optional>
Ellipsoid.WGS84 The ellipsoid to use.
surfaceHeight Number <optional>
0.0 The height of the rectangle above the ellipsoid.
result Array.<Cartesian3> <optional>
The array of Cartesians onto which to store the result.
Source:
Returns:
The modified result parameter or a new Array of Cartesians instances if none was provided.
Type
Array.<Cartesian3>

(static) union(rectangle, otherRectangle, resultopt) → {Rectangle}

Computes a rectangle that is the union of two rectangles.
Parameters:
Name Type Attributes Description
rectangle Rectangle A rectangle to enclose in rectangle.
otherRectangle Rectangle A rectangle to enclose in a rectangle.
result Rectangle <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Rectangle instance if none was provided.
Type
Rectangle

(static) unpack(array, startingIndexopt, resultopt) → {Rectangle}

Retrieves an instance from a packed array.
Parameters:
Name Type Attributes Default Description
array Array.<Number> The packed array.
startingIndex Number <optional>
0 The starting index of the element to be unpacked.
result Rectangle <optional>
The object into which to store the result.
Source:
Returns:
The modified result parameter or a new Rectangle instance if one was not provided.
Type
Rectangle

(static) validate(rectangle)

Checks an Rectangle's properties and throws if they are not in valid ranges.
Parameters:
Name Type Description
rectangle Rectangle The rectangle to validate
Source:
Throws:

clone(resultopt) → {Rectangle}

Duplicates this Rectangle.
Parameters:
Name Type Attributes Description
result Rectangle <optional>
The object onto which to store the result.
Source:
Returns:
The modified result parameter or a new Rectangle instance if none was provided.
Type
Rectangle

equals(otheropt) → {Boolean}

Compares the provided Rectangle with this Rectangle componentwise and returns true if they are equal, false otherwise.
Parameters:
Name Type Attributes Description
other Rectangle <optional>
The Rectangle to compare.
Source:
Returns:
true if the Rectangles are equal, false otherwise.
Type
Boolean

equalsEpsilon(otheropt, epsilon) → {Boolean}

Compares the provided Rectangle with this Rectangle componentwise and returns true if they are within the provided epsilon, false otherwise.
Parameters:
Name Type Attributes Description
other Rectangle <optional>
The Rectangle to compare.
epsilon Number The epsilon to use for equality testing.
Source:
Returns:
true if the Rectangles are within the provided epsilon, false otherwise.
Type
Boolean