Skip to content

KBE3D / KBCore / Cesium / BoundingRectangle

类: BoundingRectangle

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

参数

The x coordinate of the rectangle.

参数

The y coordinate of the rectangle.

参数

The width of the rectangle.

参数

The height of the rectangle.

属性

packedLength

static packedLength: number

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


x

x: number

The x coordinate of the rectangle.


y

y: number

The y coordinate of the rectangle.


width

width: number

The width of the rectangle.


height

height: number

The height of the rectangle.

方法

pack()

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

Stores the provided instance into the provided array.

参数

value

BoundingRectangle

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?: BoundingRectangle): BoundingRectangle

Retrieves an instance from a packed array.

参数

array

number[]

The packed array.

startingIndex?

number

The starting index of the element to be unpacked.

result?

BoundingRectangle

The object into which to store the result.

返回

BoundingRectangle

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


fromPoints()

static fromPoints(positions: Cartesian2[], result?: BoundingRectangle): BoundingRectangle

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

参数

positions

Cartesian2[]

List of points that the bounding rectangle will enclose. Each point must have <code>x</code> and <code>y</code> properties.

result?

BoundingRectangle

The object onto which to store the result.

返回

BoundingRectangle

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


fromRectangle()

static fromRectangle(rectangle: Rectangle, projection?: any, result?: BoundingRectangle): BoundingRectangle

Computes a bounding rectangle from a rectangle.

参数

rectangle

Rectangle

The valid rectangle used to create a bounding rectangle.

projection?

any

The projection used to project the rectangle into 2D.

result?

BoundingRectangle

The object onto which to store the result.

返回

BoundingRectangle

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


clone()

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

Duplicates a BoundingRectangle instance.

参数

rectangle

BoundingRectangle

The bounding rectangle to duplicate.

result?

BoundingRectangle

The object onto which to store the result.

返回

BoundingRectangle

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


union()

static union(left: BoundingRectangle, right: BoundingRectangle, result?: BoundingRectangle): BoundingRectangle

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

参数

left

BoundingRectangle

A rectangle to enclose in bounding rectangle.

BoundingRectangle

A rectangle to enclose in a bounding rectangle.

result?

BoundingRectangle

The object onto which to store the result.

返回

BoundingRectangle

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


expand()

static expand(rectangle: BoundingRectangle, point: Cartesian2, result?: BoundingRectangle): BoundingRectangle

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

参数

rectangle

BoundingRectangle

A rectangle to expand.

point

Cartesian2

A point to enclose in a bounding rectangle.

result?

BoundingRectangle

The object onto which to store the result.

返回

BoundingRectangle

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


intersect()

static intersect(left: BoundingRectangle, right: BoundingRectangle): Intersect

Determines if two rectangles intersect.

参数

left

BoundingRectangle

A rectangle to check for intersection.

right

BoundingRectangle

The other rectangle to check for intersection.

返回

Intersect

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


equals()

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

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

参数

left?

BoundingRectangle

The first BoundingRectangle.

right?

BoundingRectangle

The second BoundingRectangle.

返回

boolean

true if left and right are equal, false otherwise.


clone()

clone(result?: BoundingRectangle): BoundingRectangle

Duplicates this BoundingRectangle instance.

参数

result?

BoundingRectangle

The object onto which to store the result.

返回

BoundingRectangle

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


intersect()

intersect(right: BoundingRectangle): Intersect

Determines if this rectangle intersects with another.

参数

right

BoundingRectangle

A rectangle to check for intersection.

返回

Intersect

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


equals()

equals(right?: BoundingRectangle): boolean

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

参数

right?

BoundingRectangle

The right hand side BoundingRectangle.

返回

boolean

true if they are equal, false otherwise.

构造函数

构造函数

new BoundingRectangle(x?: number, y?: number, width?: number, height?: number): BoundingRectangle

参数

x?

number

y?

number

width?

number

height?

number

返回

BoundingRectangle

KBE3D @3.0.0 Copyright © 2024-present KBE3D