Skip to content

Documentation / scene / BoundingBox

Class: BoundingBox ​

Defined in: libs/scene/src/utility/bounding_volume.ts:42

The bounding box class

Extends ​

  • AABB

Implements ​

Constructors ​

Constructor ​

new BoundingBox(): BoundingBox

Defined in: libs/scene/src/utility/bounding_volume.ts:46

Creates an empty bounding box

Returns ​

BoundingBox

Overrides ​

AABB.constructor

Constructor ​

new BoundingBox(box): BoundingBox

Defined in: libs/scene/src/utility/bounding_volume.ts:51

Creates a bounding box from an AABB

Parameters ​

box ​

AABB

The AABB

Returns ​

BoundingBox

Overrides ​

AABB.constructor

Constructor ​

new BoundingBox(minPoint, maxPoint): BoundingBox

Defined in: libs/scene/src/utility/bounding_volume.ts:57

Creates a bounding box from the min point and the max point

Parameters ​

minPoint ​

Vector3

Min point of the box

maxPoint ​

Vector3

Max point of the box

Returns ​

BoundingBox

Overrides ​

AABB.constructor

Properties ​

ClipLeft ​

readonly static ClipLeft: number

Defined in: libs/base/dist/index.d.ts:4151

Clip to the left side

Inherited from ​

AABB.ClipLeft


ClipRight ​

readonly static ClipRight: number

Defined in: libs/base/dist/index.d.ts:4153

Clip to the right side

Inherited from ​

AABB.ClipRight


ClipBottom ​

readonly static ClipBottom: number

Defined in: libs/base/dist/index.d.ts:4155

Clip to the bottom side

Inherited from ​

AABB.ClipBottom


ClipTop ​

readonly static ClipTop: number

Defined in: libs/base/dist/index.d.ts:4157

Clip to the top side

Inherited from ​

AABB.ClipTop


ClipFront ​

readonly static ClipFront: number

Defined in: libs/base/dist/index.d.ts:4159

Clip to the front side

Inherited from ​

AABB.ClipFront


ClipBack ​

readonly static ClipBack: number

Defined in: libs/base/dist/index.d.ts:4161

Clip to the back side

Inherited from ​

AABB.ClipBack

Accessors ​

minPoint ​

Get Signature ​

get minPoint(): Vector3

Defined in: libs/base/dist/index.d.ts:4178

Get the min point of the AABB.

Returns ​

Vector3

Set Signature ​

set minPoint(p): void

Defined in: libs/base/dist/index.d.ts:4179

Parameters ​
p ​

Vector3

Returns ​

void

Inherited from ​

AABB.minPoint


maxPoint ​

Get Signature ​

get maxPoint(): Vector3

Defined in: libs/base/dist/index.d.ts:4181

Get the max point of the AABB.

Returns ​

Vector3

Set Signature ​

set maxPoint(p): void

Defined in: libs/base/dist/index.d.ts:4182

Parameters ​
p ​

Vector3

Returns ​

void

Inherited from ​

AABB.maxPoint


extents ​

Get Signature ​

get extents(): Vector3

Defined in: libs/base/dist/index.d.ts:4184

Get half size of the AABB.

Returns ​

Vector3

Inherited from ​

AABB.extents


center ​

Get Signature ​

get center(): Vector3

Defined in: libs/base/dist/index.d.ts:4186

Get center point of the AABB.

Returns ​

Vector3

Inherited from ​

AABB.center


size ​

Get Signature ​

get size(): Vector3

Defined in: libs/base/dist/index.d.ts:4188

Get size of the AABB.

Returns ​

Vector3

Inherited from ​

AABB.size


diagonalLength ​

Get Signature ​

get diagonalLength(): number

Defined in: libs/base/dist/index.d.ts:4190

Get the diagonal length of the AABB.

Returns ​

number

Inherited from ​

AABB.diagonalLength

Methods ​

computePoints() ​

computePoints(): Vector3[]

Defined in: libs/base/dist/index.d.ts:4195

Calculate the coordinates of the eight corners of the AABB.

Returns ​

Vector3[]

the coordinates of the eight corners of the AABB.

Inherited from ​

AABB.computePoints


inplaceTransform() ​

inplaceTransform(matrix): this

Defined in: libs/base/dist/index.d.ts:4201

Inplace transform the AABB.

Parameters ​

matrix ​

Matrix4x4

The transform matrix.

Returns ​

this

self

Inherited from ​

AABB.inplaceTransform


beginExtend() ​

beginExtend(): this

Defined in: libs/base/dist/index.d.ts:4206

Invalidate the min/max point so that we can start extending the AABB.

Returns ​

this

self

Inherited from ​

AABB.beginExtend


extend() ​

extend(v): this

Defined in: libs/base/dist/index.d.ts:4212

Extend the AABB so that it can contain specified point.

Parameters ​

v ​

Vector3

The point used to extend the AABB.

Returns ​

this

self

Inherited from ​

AABB.extend


extend3() ​

extend3(x, y, z): this

Defined in: libs/base/dist/index.d.ts:4220

Extend the AABB so that it can contain specified point.

Parameters ​

x ​

number

The x coordinate of the point.

y ​

number

The y coordinate of the point.

z ​

number

The z coordinate of the point.

Returns ​

this

self

Inherited from ​

AABB.extend3


union() ​

union(other): this

Defined in: libs/base/dist/index.d.ts:4226

Merge the AABB with another AABB.

Parameters ​

other ​

AABB

The AABB to be merged with.

Returns ​

this

self

Inherited from ​

AABB.union


isValid() ​

isValid(): boolean

Defined in: libs/base/dist/index.d.ts:4231

Check if the AABB is valid.

Returns ​

boolean

true if the AABB is valid, otherwise false.

Inherited from ​

AABB.isValid


equalsTo() ​

equalsTo(other, epsl?): boolean

Defined in: libs/base/dist/index.d.ts:4238

Check if the AABB is close enough to another AABB.

Parameters ​

other ​

AABB

The AABB to be compared with.

epsl? ​

number

The epsilon for comparison.

Returns ​

boolean

true if the comparison error is less than epsl, otherwise false.

Inherited from ​

AABB.equalsTo


intersectedWithBox() ​

intersectedWithBox(other): boolean

Defined in: libs/base/dist/index.d.ts:4244

Check if the AABB intersects with another AABB.

Parameters ​

other ​

AABB

The destination AABB.

Returns ​

boolean

true if the AABB intersects with other, otherwise false.

Inherited from ​

AABB.intersectedWithBox


containsPoint() ​

containsPoint(pt): boolean

Defined in: libs/base/dist/index.d.ts:4250

Check if the box contains specified point.

Parameters ​

pt ​

Vector3

The point to be checked.

Returns ​

boolean

true if the box contains the point, otherwise false.s

Inherited from ​

AABB.containsPoint


containsBox() ​

containsBox(other): boolean

Defined in: libs/base/dist/index.d.ts:4256

Check if the AABB contains all of the eight corner point of another AABB

Parameters ​

other ​

AABB

The AABB to be checked.

Returns ​

boolean

true if all contains, otherwise false.

Inherited from ​

AABB.containsBox


getClipStateMask() ​

getClipStateMask(viewProjMatrix, mask): NOT_CLIPPED | A_INSIDE_B | CLIPPED

Defined in: libs/base/dist/index.d.ts:4263

Do a clip test at the AABB and a frustum.

Parameters ​

viewProjMatrix ​

Matrix4x4

The view projection matrix of the frustum.

mask ​

number

The frustum planes that needs to be tested.

Returns ​

NOT_CLIPPED | A_INSIDE_B | CLIPPED

The clip test result.

Inherited from ​

AABB.getClipStateMask


getClipState() ​

getClipState(viewProjMatrix): NOT_CLIPPED | A_INSIDE_B | CLIPPED

Defined in: libs/base/dist/index.d.ts:4269

Do a clip test at the AABB and a frustum.

Parameters ​

viewProjMatrix ​

Matrix4x4

The view projection matrix of the frustum.

Returns ​

NOT_CLIPPED | A_INSIDE_B | CLIPPED

The clip test result.

Inherited from ​

AABB.getClipState


getClipStateWithFrustum() ​

getClipStateWithFrustum(frustum): NOT_CLIPPED | A_INSIDE_B | CLIPPED

Defined in: libs/base/dist/index.d.ts:4281

Do a clip test at the AABB and a frustum.

Parameters ​

frustum ​

Pick<Frustum, "planes"> | Readonly<{ planes: readonly Readonly<{[key: number]: number; a: number; b: number; c: number; d: number; assign: this; setEquation: this; initWithOriginNormal: this; initWithPoints: this; distanceToPoint: number; nearestPointToPoint: Vector3; getNormal: Vector3; inplaceFlip: Plane; inplaceNormalize: Plane; equalsTo: boolean; toString: string; isNaN: boolean; setRandom: void; }>[]; corners: readonly Readonly<{[key: number]: number; equalsTo: boolean; toString: string; isNaN: boolean; setRandom: void; clone: Vector3; x: number; y: number; z: number; magnitude: number; magnitudeSq: number; xy: Vector2; setXYZ: this; setAndNormalize: this; subBy: this; addBy: this; combineBy: this; mulBy: this; divBy: this; scaleBy: this; inplaceNormalize: this; inplaceInverse: this; inplaceMin: this; inplaceMax: this; }>[]; getCorner: Readonly<{[x: number]: number; clone: () => Vector3; x: number; y: number; z: number; magnitude: number; magnitudeSq: number; xy: () => Vector2; setXYZ: (x, y, z) => Vector3; setAndNormalize: (x, y, z) => Vector3; subBy: (other) => Vector3; addBy: (other) => Vector3; combineBy: (other, t0, t1) => Vector3; mulBy: (other) => Vector3; divBy: (other) => Vector3; scaleBy: (f) => Vector3; inplaceNormalize: () => Vector3; inplaceInverse: () => Vector3; inplaceMin: (other) => Vector3; inplaceMax: (other) => Vector3; equalsTo: (other, epsl?) => boolean; toString: () => string; isNaN: () => boolean; setRandom: (minValue, maxValue) => void; BYTES_PER_ELEMENT: number; buffer: Readonly<{ byteLength: number; slice: (begin?, end?) => ArrayBuffer; [toStringTag]: "ArrayBuffer"; }>; byteLength: number; byteOffset: number; copyWithin: (target, start, end?) => Vector3; every: (predicate, thisArg?) => boolean; fill: (value, start?, end?) => Vector3; filter: (predicate, thisArg?) => Float32Array<ArrayBuffer>; find: (predicate, thisArg?) => number | undefined; findIndex: (predicate, thisArg?) => number; forEach: (callbackfn, thisArg?) => void; indexOf: (searchElement, fromIndex?) => number; join: (separator?) => string; lastIndexOf: (searchElement, fromIndex?) => number; length: number; map: (callbackfn, thisArg?) => Float32Array<ArrayBuffer>; reduce: {(callbackfn): number; (callbackfn, initialValue): number; <U>(callbackfn, initialValue): U; }; reduceRight: {(callbackfn): number; (callbackfn, initialValue): number; <U>(callbackfn, initialValue): U; }; reverse: () => Vector3; set: (array, offset?) => void; slice: (start?, end?) => Float32Array<ArrayBuffer>; some: (predicate, thisArg?) => boolean; sort: (compareFn?) => Vector3; subarray: (begin?, end?) => Float32Array<ArrayBuffer>; toLocaleString: {(): string; (locales, options?): string; }; valueOf: () => Vector3; entries: () => ArrayIterator<[number, number]>; keys: () => ArrayIterator<number>; values: () => ArrayIterator<number>; includes: (searchElement, fromIndex?) => boolean; [iterator]: () => ArrayIterator<number>; [toStringTag]: "Float32Array"; }>; containsPoint: boolean; initWithMatrix: this; }>

The frustum object.

Returns ​

NOT_CLIPPED | A_INSIDE_B | CLIPPED

The clip test result.

Inherited from ​

AABB.getClipStateWithFrustum


getClipStateWithFrustumMask() ​

getClipStateWithFrustumMask(frustum, mask): NOT_CLIPPED | A_INSIDE_B | CLIPPED

Defined in: libs/base/dist/index.d.ts:4288

Do a clip test at the AABB and a frustum.

Parameters ​

frustum ​

Pick<Frustum, "planes"> | Readonly<{ planes: readonly Readonly<{[key: number]: number; a: number; b: number; c: number; d: number; assign: this; setEquation: this; initWithOriginNormal: this; initWithPoints: this; distanceToPoint: number; nearestPointToPoint: Vector3; getNormal: Vector3; inplaceFlip: Plane; inplaceNormalize: Plane; equalsTo: boolean; toString: string; isNaN: boolean; setRandom: void; }>[]; corners: readonly Readonly<{[key: number]: number; equalsTo: boolean; toString: string; isNaN: boolean; setRandom: void; clone: Vector3; x: number; y: number; z: number; magnitude: number; magnitudeSq: number; xy: Vector2; setXYZ: this; setAndNormalize: this; subBy: this; addBy: this; combineBy: this; mulBy: this; divBy: this; scaleBy: this; inplaceNormalize: this; inplaceInverse: this; inplaceMin: this; inplaceMax: this; }>[]; getCorner: Readonly<{[x: number]: number; clone: () => Vector3; x: number; y: number; z: number; magnitude: number; magnitudeSq: number; xy: () => Vector2; setXYZ: (x, y, z) => Vector3; setAndNormalize: (x, y, z) => Vector3; subBy: (other) => Vector3; addBy: (other) => Vector3; combineBy: (other, t0, t1) => Vector3; mulBy: (other) => Vector3; divBy: (other) => Vector3; scaleBy: (f) => Vector3; inplaceNormalize: () => Vector3; inplaceInverse: () => Vector3; inplaceMin: (other) => Vector3; inplaceMax: (other) => Vector3; equalsTo: (other, epsl?) => boolean; toString: () => string; isNaN: () => boolean; setRandom: (minValue, maxValue) => void; BYTES_PER_ELEMENT: number; buffer: Readonly<{ byteLength: number; slice: (begin?, end?) => ArrayBuffer; [toStringTag]: "ArrayBuffer"; }>; byteLength: number; byteOffset: number; copyWithin: (target, start, end?) => Vector3; every: (predicate, thisArg?) => boolean; fill: (value, start?, end?) => Vector3; filter: (predicate, thisArg?) => Float32Array<ArrayBuffer>; find: (predicate, thisArg?) => number | undefined; findIndex: (predicate, thisArg?) => number; forEach: (callbackfn, thisArg?) => void; indexOf: (searchElement, fromIndex?) => number; join: (separator?) => string; lastIndexOf: (searchElement, fromIndex?) => number; length: number; map: (callbackfn, thisArg?) => Float32Array<ArrayBuffer>; reduce: {(callbackfn): number; (callbackfn, initialValue): number; <U>(callbackfn, initialValue): U; }; reduceRight: {(callbackfn): number; (callbackfn, initialValue): number; <U>(callbackfn, initialValue): U; }; reverse: () => Vector3; set: (array, offset?) => void; slice: (start?, end?) => Float32Array<ArrayBuffer>; some: (predicate, thisArg?) => boolean; sort: (compareFn?) => Vector3; subarray: (begin?, end?) => Float32Array<ArrayBuffer>; toLocaleString: {(): string; (locales, options?): string; }; valueOf: () => Vector3; entries: () => ArrayIterator<[number, number]>; keys: () => ArrayIterator<number>; values: () => ArrayIterator<number>; includes: (searchElement, fromIndex?) => boolean; [iterator]: () => ArrayIterator<number>; [toStringTag]: "Float32Array"; }>; containsPoint: boolean; initWithMatrix: this; }>

The frustum object.

mask ​

number

The frustum planes that needs to be tested.

Returns ​

NOT_CLIPPED | A_INSIDE_B | CLIPPED

The clip test result.

Inherited from ​

AABB.getClipStateWithFrustumMask


transform() ​

static transform(bbox, matrix, result?): AABB

Defined in: libs/base/dist/index.d.ts:4296

Get an AABB by transforming another AABB

Parameters ​

bbox ​

AABB

The AABB to be transformed.

matrix ​

Matrix4x4

The transform matrix.

result? ​

AABB

The out AABB to be write to.

Returns ​

AABB

The out AABB.

Inherited from ​

AABB.transform


behindPlane() ​

behindPlane(plane): boolean

Defined in: libs/scene/src/utility/bounding_volume.ts:62

Check if this bounding volume is behind a plane

Parameters ​

plane ​

Plane

The plane to check

Returns ​

boolean

true if the bounding volume behinds the plane, false otherwise

Implementation of ​

BoundingVolume.behindPlane

Overrides ​

AABB.behindPlane


clone() ​

clone(): BoundingBox

Defined in: libs/scene/src/utility/bounding_volume.ts:66

Creates a new bounding volume by copying from this bounding volume

Returns ​

BoundingBox

Implementation of ​

BoundingVolume.clone

Overrides ​

AABB.clone


transform() ​

transform(matrix): BoundingBox

Defined in: libs/scene/src/utility/bounding_volume.ts:70

Creates a new bounding volume by tranforming this bounding volume by a matrix

Parameters ​

matrix ​

Matrix4x4

The transform matrix

Returns ​

BoundingBox

The created bounding volume

Implementation of ​

BoundingVolume.transform


outsideFrustum() ​

outsideFrustum(frustum): boolean

Defined in: libs/scene/src/utility/bounding_volume.ts:74

Check if this bounding volume is outside a frustum

Parameters ​

frustum ​

Matrix4x4 | Frustum

The frustum to check

Returns ​

boolean

true if the bounding volume outsides the frustum, false otherwise

Implementation of ​

BoundingVolume.outsideFrustum


toAABB() ​

toAABB(): BoundingBox

Defined in: libs/scene/src/utility/bounding_volume.ts:81

Gets the minimum AABB that contains the bounding volume

Returns ​

BoundingBox

The mimimum AABB that contains the bounding volume

Implementation of ​

BoundingVolume.toAABB

Released under the MIT License.