# BoxGeometry

#### new Cesium.BoxGeometry(options)
engine/Source/Core/BoxGeometry.js 42

Describes a cube centered at the origin.

Name | Type | Description
--- | --- | ---

`options`

object

Object with the following properties:

Name | Type | Default | Description
--- | --- | --- | ---
`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` | optional The vertex attributes to be computed.

##### Example:

    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:

- Cesium Sandcastle Box Demo

##### See:

- BoxGeometry.fromDimensions
- BoxGeometry.createGeometry
- Packable

### Members

#### static Cesium.BoxGeometry.packedLength : number
engine/Source/Core/BoxGeometry.js 146

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

### Methods

#### static Cesium.BoxGeometry.createGeometry(boxGeometry) → Geometry|undefined
engine/Source/Core/BoxGeometry.js 246

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

Name | Type | Description
--- | --- | ---
`boxGeometry` | BoxGeometry | A description of the box.

##### Returns:

The computed vertices and indices.

#### static Cesium.BoxGeometry.fromAxisAlignedBoundingBox(boundingBox) → BoxGeometry
engine/Source/Core/BoxGeometry.js 131

Creates a cube from the dimensions of an AxisAlignedBoundingBox.

Name | Type | Description
--- | --- | ---
`boundingBox` | AxisAlignedBoundingBox | A description of the AxisAlignedBoundingBox.

##### Returns:

##### Example:

    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);

##### See:

- BoxGeometry.createGeometry

#### static Cesium.BoxGeometry.fromDimensions(options) → BoxGeometry
engine/Source/Core/BoxGeometry.js 90

Creates a cube centered at the origin given its dimensions.

Name | Type | Description
--- | --- | ---

`options`

object

Object with the following properties:

Name | Type | Default | Description
--- | --- | --- | ---
`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` | optional The vertex attributes to be computed.

##### Returns:

##### Throws:

- DeveloperError : All dimensions components must be greater than or equal to zero.

##### Example:

    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);

##### See:

- BoxGeometry.createGeometry

#### static Cesium.BoxGeometry.pack(value, array, startingIndex) → Array.<number>
engine/Source/Core/BoxGeometry.js 158

Stores the provided instance into the provided array.

Name | Type | Default | Description
--- | --- | --- | ---
`value` | BoxGeometry |  | The value to pack.
`array` | Array.<number> |  | The array to pack into.
`startingIndex` | number | `0` | optional The index into the array at which to start packing the elements.

##### Returns:

The array that was packed into

#### static Cesium.BoxGeometry.unpack(array, startingIndex, result) → BoxGeometry
engine/Source/Core/BoxGeometry.js 202

Retrieves an instance from a packed array.

Name | Type | Default | Description
--- | --- | --- | ---
`array` | Array.<number> |  | The packed array.
`startingIndex` | number | `0` | optional The starting index of the element to be unpacked.
`result` | BoxGeometry |  | optional The object into which to store the result.

##### Returns:

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

Need help? The fastest way to get answers is from the community and team on the Cesium Forum.