Skip to content

KBE3D / KBCore / Cesium / BoxGeometry

类: BoxGeometry

Describes a cube centered at the origin.

示例

ts
const box = new Cesium.BoxGeometry({
  vertexFormat : Cesium.VertexFormat.POSITION_ONLY,
  maximum : new Cesium.Cartesian3(250000.0, 250000.0, 250000.0),
  minimum : new Cesium.Cartesian3(-250000.0, -250000.0, -250000.0)
});
const geometry = Cesium.BoxGeometry.createGeometry(box);

参数

Object with the following properties:

参数

The minimum x, y, and z coordinates of the box.

参数

The maximum x, y, and z coordinates of the box.

参数

The vertex attributes to be computed.

属性

packedLength

static packedLength: number

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

方法

fromDimensions()

static fromDimensions(options: { dimensions: Cartesian3; vertexFormat?: VertexFormat; }): BoxGeometry

Creates a cube centered at the origin given its dimensions.

参数

options

Object with the following properties:

dimensions

Cartesian3

The width, depth, and height of the box stored in the x, y, and z coordinates of the <code>Cartesian3</code>, respectively.

vertexFormat?

VertexFormat

The vertex attributes to be computed.

返回

BoxGeometry

示例

ts
const box = Cesium.BoxGeometry.fromDimensions({
  vertexFormat : Cesium.VertexFormat.POSITION_ONLY,
  dimensions : new Cesium.Cartesian3(500000.0, 500000.0, 500000.0)
});
const geometry = Cesium.BoxGeometry.createGeometry(box);

fromAxisAlignedBoundingBox()

static fromAxisAlignedBoundingBox(boundingBox: AxisAlignedBoundingBox): BoxGeometry

Creates a cube from the dimensions of an AxisAlignedBoundingBox.

参数

boundingBox

AxisAlignedBoundingBox

A description of the AxisAlignedBoundingBox.

返回

BoxGeometry

示例

ts
const aabb = Cesium.AxisAlignedBoundingBox.fromPoints(Cesium.Cartesian3.fromDegreesArray([
     -72.0, 40.0,
     -70.0, 35.0,
     -75.0, 30.0,
     -70.0, 30.0,
     -68.0, 40.0
]));
const box = Cesium.BoxGeometry.fromAxisAlignedBoundingBox(aabb);

pack()

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

Stores the provided instance into the provided array.

参数

value

BoxGeometry

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

Retrieves an instance from a packed array.

参数

array

number[]

The packed array.

startingIndex?

number

The starting index of the element to be unpacked.

result?

BoxGeometry

The object into which to store the result.

返回

BoxGeometry

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


createGeometry()

static createGeometry(boxGeometry: BoxGeometry): Geometry | undefined

Computes the geometric representation of a box, including its vertices, indices, and a bounding sphere.

参数

boxGeometry

BoxGeometry

A description of the box.

返回

Geometry | undefined

The computed vertices and indices.

构造函数

构造函数

new BoxGeometry(options: { minimum: Cartesian3; maximum: Cartesian3; vertexFormat?: VertexFormat; }): BoxGeometry

参数

options
minimum

Cartesian3

maximum

Cartesian3

vertexFormat?

VertexFormat

返回

BoxGeometry

KBE3D @3.0.0 Copyright © 2024-present KBE3D