Skip to content

KBE3D / KBCore / Cesium / Rectangle

类: Rectangle

A two dimensional region specified as longitude and latitude coordinates.

参数

The westernmost longitude, in radians, in the range [-Pi, Pi].

参数

The southernmost latitude, in radians, in the range [-Pi/2, Pi/2].

参数

The easternmost longitude, in radians, in the range [-Pi, Pi].

参数

The northernmost latitude, in radians, in the range [-Pi/2, Pi/2].

属性

packedLength

static packedLength: number

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


MAX_VALUE

readonly static MAX_VALUE: Rectangle

The largest possible rectangle.


west

west: number

The westernmost longitude in radians in the range [-Pi, Pi].


south

south: number

The southernmost latitude in radians in the range [-Pi/2, Pi/2].


east

east: number

The easternmost longitude in radians in the range [-Pi, Pi].


north

north: number

The northernmost latitude in radians in the range [-Pi/2, Pi/2].


width

readonly width: number

Gets the width of the rectangle in radians.


height

readonly height: number

Gets the height of the rectangle in radians.

方法

pack()

static pack(value: Rectangle, array: number[], startingIndex?: number): number[]

Stores the provided instance into the provided array.

参数

value

Rectangle

The value to pack.

array

number[]

The array to pack into.

startingIndex?

number

The index into the array at which to start packing the elements.

返回

number[]

The array that was packed into


unpack()

static unpack(array: number[], startingIndex?: number, result?: Rectangle): Rectangle

Retrieves an instance from a packed array.

参数

array

number[]

The packed array.

startingIndex?

number

The starting index of the element to be unpacked.

result?

Rectangle

The object into which to store the result.

返回

Rectangle

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


computeWidth()

static computeWidth(rectangle: Rectangle): number

Computes the width of a rectangle in radians.

参数

rectangle

Rectangle

The rectangle to compute the width of.

返回

number

The width.


computeHeight()

static computeHeight(rectangle: Rectangle): number

Computes the height of a rectangle in radians.

参数

rectangle

Rectangle

The rectangle to compute the height of.

返回

number

The height.


fromDegrees()

static fromDegrees(west?: number, south?: number, east?: number, north?: number, result?: Rectangle): Rectangle

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

参数

west?

number

The westernmost longitude in degrees in the range [-180.0, 180.0].

south?

number

The southernmost latitude in degrees in the range [-90.0, 90.0].

east?

number

The easternmost longitude in degrees in the range [-180.0, 180.0].

north?

number

The northernmost latitude in degrees in the range [-90.0, 90.0].

result?

Rectangle

The object onto which to store the result, or undefined if a new instance should be created.

返回

Rectangle

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

示例

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

fromRadians()

static fromRadians(west?: number, south?: number, east?: number, north?: number, result?: Rectangle): Rectangle

Creates a rectangle given the boundary longitude and latitude in radians.

参数

west?

number

The westernmost longitude in radians in the range [-Math.PI, Math.PI].

south?

number

The southernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].

east?

number

The easternmost longitude in radians in the range [-Math.PI, Math.PI].

north?

number

The northernmost latitude in radians in the range [-Math.PI/2, Math.PI/2].

result?

Rectangle

The object onto which to store the result, or undefined if a new instance should be created.

返回

Rectangle

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

示例

ts
const rectangle = Cesium.Rectangle.fromRadians(0.0, Math.PI/4, Math.PI/8, 3*Math.PI/4);

fromCartographicArray()

static fromCartographicArray(cartographics: Cartographic[], result?: Rectangle): Rectangle

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

参数

cartographics

Cartographic[]

The list of Cartographic instances.

result?

Rectangle

The object onto which to store the result, or undefined if a new instance should be created.

返回

Rectangle

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


fromCartesianArray()

static fromCartesianArray(cartesians: Cartesian3[], ellipsoid?: Ellipsoid, result?: Rectangle): Rectangle

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

参数

cartesians

Cartesian3[]

The list of Cartesian instances.

ellipsoid?

Ellipsoid

The ellipsoid the cartesians are on.

result?

Rectangle

The object onto which to store the result, or undefined if a new instance should be created.

返回

Rectangle

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


fromBoundingSphere()

static fromBoundingSphere(boundingSphere: BoundingSphere, ellipsoid?: Ellipsoid, result?: Rectangle): Rectangle

Create a rectangle from a bounding sphere, ignoring height.

参数

boundingSphere

BoundingSphere

The bounding sphere.

ellipsoid?

Ellipsoid

The ellipsoid.

result?

Rectangle

The object onto which to store the result, or undefined if a new instance should be created.

返回

Rectangle

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


clone()

static clone(rectangle: Rectangle, result?: Rectangle): Rectangle

Duplicates a Rectangle.

参数

rectangle

Rectangle

The rectangle to clone.

result?

Rectangle

The object onto which to store the result, or undefined if a new instance should be created.

返回

Rectangle

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


equalsEpsilon()

static equalsEpsilon(left?: Rectangle, right?: Rectangle, absoluteEpsilon?: number): boolean

Compares the provided Rectangles componentwise and returns <code>true</code> if they pass an absolute or relative tolerance test, <code>false</code> otherwise.

参数

left?

Rectangle

The first Rectangle.

Rectangle

The second Rectangle.

absoluteEpsilon?

number

The absolute epsilon tolerance to use for equality testing.

返回

boolean

true if left and right are within the provided epsilon, false otherwise.


equals()

static equals(left?: Rectangle, right?: Rectangle): boolean

Compares the provided rectangles and returns <code>true</code> if they are equal, <code>false</code> otherwise.

参数

left?

Rectangle

The first Rectangle.

right?

Rectangle

The second Rectangle.

返回

boolean

true if left and right are equal; otherwise false.


southwest()

static southwest(rectangle: Rectangle, result?: Cartographic): Cartographic

Computes the southwest corner of a rectangle.

参数

rectangle

Rectangle

The rectangle for which to find the corner

result?

Cartographic

The object onto which to store the result.

返回

Cartographic

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


northwest()

static northwest(rectangle: Rectangle, result?: Cartographic): Cartographic

Computes the northwest corner of a rectangle.

参数

rectangle

Rectangle

The rectangle for which to find the corner

result?

Cartographic

The object onto which to store the result.

返回

Cartographic

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


northeast()

static northeast(rectangle: Rectangle, result?: Cartographic): Cartographic

Computes the northeast corner of a rectangle.

参数

rectangle

Rectangle

The rectangle for which to find the corner

result?

Cartographic

The object onto which to store the result.

返回

Cartographic

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


southeast()

static southeast(rectangle: Rectangle, result?: Cartographic): Cartographic

Computes the southeast corner of a rectangle.

参数

rectangle

Rectangle

The rectangle for which to find the corner

result?

Cartographic

The object onto which to store the result.

返回

Cartographic

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


center()

static center(rectangle: Rectangle, result?: Cartographic): Cartographic

Computes the center of a rectangle.

参数

rectangle

Rectangle

The rectangle for which to find the center

result?

Cartographic

The object onto which to store the result.

返回

Cartographic

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


intersection()

static intersection(rectangle: Rectangle, otherRectangle: Rectangle, result?: Rectangle): 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.

参数

rectangle

Rectangle

On rectangle to find an intersection

otherRectangle

Rectangle

Another rectangle to find an intersection

result?

Rectangle

The object onto which to store the result.

返回

Rectangle | undefined

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


simpleIntersection()

static simpleIntersection(rectangle: Rectangle, otherRectangle: Rectangle, result?: Rectangle): 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).

参数

rectangle

Rectangle

On rectangle to find an intersection

otherRectangle

Rectangle

Another rectangle to find an intersection

result?

Rectangle

The object onto which to store the result.

返回

Rectangle | undefined

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


union()

static union(rectangle: Rectangle, otherRectangle: Rectangle, result?: Rectangle): Rectangle

Computes a rectangle that is the union of two rectangles.

参数

rectangle

Rectangle

A rectangle to enclose in rectangle.

otherRectangle

Rectangle

A rectangle to enclose in a rectangle.

result?

Rectangle

The object onto which to store the result.

返回

Rectangle

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


expand()

static expand(rectangle: Rectangle, cartographic: Cartographic, result?: Rectangle): Rectangle

Computes a rectangle by enlarging the provided rectangle until it contains the provided cartographic.

参数

rectangle

Rectangle

A rectangle to expand.

cartographic

Cartographic

A cartographic to enclose in a rectangle.

result?

Rectangle

The object onto which to store the result.

返回

Rectangle

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


contains()

static contains(rectangle: Rectangle, cartographic: Cartographic): boolean

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

参数

rectangle

Rectangle

The rectangle

cartographic

Cartographic

The cartographic to test.

返回

boolean

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


subsample()

static subsample(rectangle: Rectangle, ellipsoid?: Ellipsoid, surfaceHeight?: number, result?: Cartesian3[]): Cartesian3[]

Samples a 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.

参数

rectangle

Rectangle

The rectangle to subsample.

ellipsoid?

Ellipsoid

The ellipsoid to use.

surfaceHeight?

number

The height of the rectangle above the ellipsoid.

result?

Cartesian3[]

The array of Cartesians onto which to store the result.

返回

Cartesian3[]

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


subsection()

static subsection(rectangle: Rectangle, westLerp: number, southLerp: number, eastLerp: number, northLerp: number, result?: Rectangle): Rectangle

Computes a subsection of a rectangle from normalized coordinates in the range [0.0, 1.0].

参数

rectangle

Rectangle

The rectangle to subsection.

westLerp

number

The west interpolation factor in the range [0.0, 1.0]. Must be less than or equal to eastLerp.

southLerp

number

The south interpolation factor in the range [0.0, 1.0]. Must be less than or equal to northLerp.

eastLerp

number

The east interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to westLerp.

northLerp

number

The north interpolation factor in the range [0.0, 1.0]. Must be greater than or equal to southLerp.

result?

Rectangle

The object onto which to store the result.

返回

Rectangle

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


clone()

clone(result?: Rectangle): Rectangle

Duplicates this Rectangle.

参数

result?

Rectangle

The object onto which to store the result.

返回

Rectangle

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


equals()

equals(other?: Rectangle): boolean

Compares the provided Rectangle with this Rectangle componentwise and returns <code>true</code> if they are equal, <code>false</code> otherwise.

参数

other?

Rectangle

The Rectangle to compare.

返回

boolean

true if the Rectangles are equal, false otherwise.


equalsEpsilon()

equalsEpsilon(other?: Rectangle, epsilon?: number): boolean

Compares the provided Rectangle with this Rectangle componentwise and returns <code>true</code> if they are within the provided epsilon, <code>false</code> otherwise.

参数

other?

Rectangle

The Rectangle to compare.

epsilon?

number

The epsilon to use for equality testing.

返回

boolean

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

构造函数

构造函数

new Rectangle(west?: number, south?: number, east?: number, north?: number): Rectangle

参数

west?

number

south?

number

east?

number

north?

number

返回

Rectangle

KBE3D @3.0.0 Copyright © 2024-present KBE3D