Skip to content

Box3 ​

Axis-aligned bounding box defined by minimum and maximum corners.

Box3 represents a 3D region bounded by two corners: min and max. It is used for spatial queries, culling tests, intersection checks, and computing bounding volumes. A default-constructed box is empty and intersection treats boxes as half-open intervals.

Constructor ​

Creates a box from optional corner points. The corners are cloned. When a corner is omitted the box starts empty.

ts
new Box3(min?, max?): Box3;
ParameterDescription
min?: vec3The minimum corner.
max?: vec3The maximum corner.

Properties ​

min ​

Minimum corner of the box.

ts
min: vec3;

max ​

Maximum corner of the box.

ts
max: vec3;

Methods ​

clone() Box3 ​

Returns a deep copy of the box.

ts
clone(): Box3;

isEmpty() boolean ​

Returns true when the box encloses no volume.

ts
isEmpty(): boolean;

intersects() boolean ​

Tests whether two boxes overlap. Boxes are treated as half-open intervals so touching faces do not count as overlap.

ts
static intersects(a, b): boolean;
ParameterDescription
a: Box3The first box.
b: Box3The second box.

expandWithPoint() void ​

Grows the box in place to contain the given point.

ts
expandWithPoint(p): void;
ParameterDescription
p: vec3The point to include.

applyTransform() void ​

Transforms the box in place by the given matrix. The result is the axis-aligned box of the eight transformed corners so the box can grow under rotation.

ts
applyTransform(matrix): void;
ParameterDescription
matrix: mat4The transform to apply.

Released under the MIT License