BoxGeometry

new Cesium.BoxGeometry(options)

Describes a cube centered at the origin.
参数名称 类型 描述信息
options object Object with the following properties:
参数名称 类型 默认值 描述信息
minimum Cartesian3 The minimum x, y, and z coordinates of the box.
maximum Cartesian3 The maximum x, y, and z coordinates of the box.
vertexFormat VertexFormat VertexFormat.DEFAULT 可选 The vertex attributes to be computed.
使用示例:
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);
Demo:
参考:

成员(属性)

static Cesium.BoxGeometry.packedLength : number

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

方法

static Cesium.BoxGeometry.createGeometry(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.
返回值:
The computed vertices and indices.

static Cesium.BoxGeometry.fromAxisAlignedBoundingBox(boundingBox)BoxGeometry

Creates a cube from the dimensions of an AxisAlignedBoundingBox.
参数名称 类型 描述信息
boundingBox AxisAlignedBoundingBox A description of the AxisAlignedBoundingBox.
返回值:
使用示例:
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);
参考:

static Cesium.BoxGeometry.fromDimensions(options)BoxGeometry

Creates a cube centered at the origin given its dimensions.
参数名称 类型 描述信息
options object 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 Cartesian3, respectively.
vertexFormat VertexFormat VertexFormat.DEFAULT 可选 The vertex attributes to be computed.
返回值:
Throws:
  • DeveloperError : All dimensions components must be greater than or equal to zero.
使用示例:
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);
参考:

static Cesium.BoxGeometry.pack(value, array, startingIndex)Array.<number>

Stores the provided instance into the provided array.
参数名称 类型 默认值 描述信息
value BoxGeometry The value to pack.
array Array.<number> The array to pack into.
startingIndex number 0 可选 The index into the array at which to start packing the elements.
返回值:
The array that was packed into

static Cesium.BoxGeometry.unpack(array, startingIndex, result)BoxGeometry

Retrieves an instance from a packed array.
参数名称 类型 默认值 描述信息
array Array.<number> The packed array.
startingIndex number 0 可选 The starting index of the element to be unpacked.
result BoxGeometry 可选 The object into which to store the result.
返回值:
The modified result parameter or a new BoxGeometry instance if one was not provided.