new Rectangle
A two dimensional region specified as longitude and latitude coordinates.
Parameters:
| Name | Type | Argument | 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]. |
Members
-
east :Number
-
The easternmost longitude in radians in the range [-Pi, Pi].
- Default Value:
- 0.0
-
north :Number
-
The northernmost latitude in radians in the range [-Pi/2, Pi/2].
- Default Value:
- 0.0
-
south :Number
-
The southernmost latitude in radians in the range [-Pi/2, Pi/2].
- Default Value:
- 0.0
-
west :Number
-
The westernmost longitude in radians in the range [-Pi, Pi].
- Default Value:
- 0.0
-
<static> MAX_VALUE :Rectangle
-
The largest possible rectangle.
-
<static> packedLength :Number
-
The number of elements used to pack the object into an array.
Methods
-
clone
-
Duplicates this Rectangle.
Parameters:
Name Type Argument Description resultRectangle <optional>
The object onto which to store the result. Returns:
Rectangle The modified result parameter or a new Rectangle instance if none was provided. -
equals
-
Compares the provided Rectangle with this Rectangle componentwise and returns
trueif they are equal,falseotherwise.Parameters:
Name Type Argument Description otherRectangle <optional>
The Rectangle to compare. Returns:
Booleantrueif the Rectangles are equal,falseotherwise. -
equalsEpsilon
-
Compares the provided Rectangle with this Rectangle componentwise and returns
trueif they are within the provided epsilon,falseotherwise.Parameters:
Name Type Argument Description otherRectangle <optional>
The Rectangle to compare. epsilonNumber The epsilon to use for equality testing. Returns:
Booleantrueif the Rectangles are within the provided epsilon,falseotherwise. -
<static> clone
-
Duplicates an Rectangle.
Parameters:
Name Type Argument Description rectangleRectangle The rectangle to clone. resultRectangle <optional>
The object onto which to store the result, or undefined if a new instance should be created. Returns:
Rectangle The modified result parameter or a new Rectangle instance if none was provided. (Returns undefined if rectangle is undefined) -
<static> contains
-
Returns true if the cartographic is on or inside the rectangle, false otherwise.
Parameters:
Name Type Description rectangleRectangle The rectangle cartographicCartographic The cartographic to test. Returns:
Boolean true if the provided cartographic is inside the rectangle, false otherwise. -
<static> equals
-
Compares the provided rectangles and returns
trueif they are equal,falseotherwise.Parameters:
Name Type Argument Description leftRectangle <optional>
The first Rectangle. rightRectangle <optional>
The second Rectangle. Returns:
Booleantrueif left and right are equal; otherwisefalse. -
<static> fromCartographicArray
-
Creates the smallest possible Rectangle that encloses all positions in the provided array.
Parameters:
Name Type Argument Description cartographicsArray The list of Cartographic instances. resultRectangle <optional>
The object onto which to store the result, or undefined if a new instance should be created. Returns:
Rectangle The modified result parameter or a new Rectangle instance if none was provided. -
<static> fromDegrees
-
Creates an rectangle given the boundary longitude and latitude in degrees.
Parameters:
Name Type Argument Default Description westNumber <optional>
0.0 The westernmost longitude in degrees in the range [-180.0, 180.0]. southNumber <optional>
0.0 The southernmost latitude in degrees in the range [-90.0, 90.0]. eastNumber <optional>
0.0 The easternmost longitude in degrees in the range [-180.0, 180.0]. northNumber <optional>
0.0 The northernmost latitude in degrees in the range [-90.0, 90.0]. resultRectangle <optional>
The object onto which to store the result, or undefined if a new instance should be created. Returns:
Rectangle 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);
-
<static> getCenter
-
Computes the center of an rectangle.
Parameters:
Name Type Argument Description rectangleRectangle The rectangle for which to find the center resultCartographic <optional>
The object onto which to store the result. Returns:
Cartographic The modified result parameter or a new Cartographic instance if none was provided. -
<static> getNortheast
-
Computes the northeast corner of an rectangle.
Parameters:
Name Type Argument Description rectangleRectangle The rectangle for which to find the corner resultCartographic <optional>
The object onto which to store the result. Returns:
Cartographic The modified result parameter or a new Cartographic instance if none was provided. -
<static> getNorthwest
-
Computes the northwest corner of an rectangle.
Parameters:
Name Type Argument Description rectangleRectangle The rectangle for which to find the corner resultCartographic <optional>
The object onto which to store the result. Returns:
Cartographic The modified result parameter or a new Cartographic instance if none was provided. -
<static> getSoutheast
-
Computes the southeast corner of an rectangle.
Parameters:
Name Type Argument Description rectangleRectangle The rectangle for which to find the corner resultCartographic <optional>
The object onto which to store the result. Returns:
Cartographic The modified result parameter or a new Cartographic instance if none was provided. -
<static> getSouthwest
-
Computes the southwest corner of an rectangle.
Parameters:
Name Type Argument Description rectangleRectangle The rectangle for which to find the corner resultCartographic <optional>
The object onto which to store the result. Returns:
Cartographic The modified result parameter or a new Cartographic instance if none was provided. -
<static> intersectWith
-
Computes the intersection of two rectangles
Parameters:
Name Type Argument Description rectangleRectangle On rectangle to find an intersection otherRectangleAnother rectangle to find an intersection resultRectangle <optional>
The object onto which to store the result. Returns:
Rectangle The modified result parameter or a new Rectangle instance if none was provided. -
<static> isEmpty
-
Determines if the rectangle is empty, i.e., if
west >= eastorsouth >= north.Parameters:
Name Type Description rectangleRectangle The rectangle Returns:
Boolean True if the rectangle is empty; otherwise, false. -
<static> pack
-
Stores the provided instance into the provided array.
Parameters:
Name Type Argument Default Description valueRectangle The value to pack. arrayArray The array to pack into. startingIndexNumber <optional>
0 The index into the array at which to start packing the elements. -
<static> subsample
-
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 Argument Default Description rectangleRectangle The rectangle to subsample. ellipsoidEllipsoid <optional>
Ellipsoid.WGS84 The ellipsoid to use. surfaceHeightNumber <optional>
0.0 The height of the rectangle above the ellipsoid. resultArray <optional>
The array of Cartesians onto which to store the result. Returns:
Array The modified result parameter or a new Array of Cartesians instances if none was provided. -
<static> unpack
-
Retrieves an instance from a packed array.
Parameters:
Name Type Argument Default Description arrayArray The packed array. startingIndexNumber <optional>
0 The starting index of the element to be unpacked. resultRectangle <optional>
The object into which to store the result. -
<static> validate
-
Checks an Rectangle's properties and throws if they are not in valid ranges.
Parameters:
Name Type Description rectangleRectangle The rectangle to validate Throws:
