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.
new Box3(min?, max?): Box3;| Parameter | Description |
|---|---|
min?: vec3 | The minimum corner. |
max?: vec3 | The maximum corner. |
Properties
min
Minimum corner of the box.
min: vec3;max
Maximum corner of the box.
max: vec3;Methods
clone() Box3
Returns a deep copy of the box.
clone(): Box3;isEmpty() boolean
Returns true when the box encloses no volume.
isEmpty(): boolean;intersects() boolean
Tests whether two boxes overlap. Boxes are treated as half-open intervals so touching faces do not count as overlap.
static intersects(a, b): boolean;| Parameter | Description |
|---|---|
a: Box3 | The first box. |
b: Box3 | The second box. |
expandWithPoint() void
Grows the box in place to contain the given point.
expandWithPoint(p): void;| Parameter | Description |
|---|---|
p: vec3 | The 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.
applyTransform(matrix): void;| Parameter | Description |
|---|---|
matrix: mat4 | The transform to apply. |