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
readonlystaticClipLeft:number
Defined in: libs/base/dist/index.d.ts:4115
Clip to the left side
Inherited from
AABB.ClipLeft
ClipRight
readonlystaticClipRight:number
Defined in: libs/base/dist/index.d.ts:4117
Clip to the right side
Inherited from
AABB.ClipRight
ClipBottom
readonlystaticClipBottom:number
Defined in: libs/base/dist/index.d.ts:4119
Clip to the bottom side
Inherited from
AABB.ClipBottom
ClipTop
readonlystaticClipTop:number
Defined in: libs/base/dist/index.d.ts:4121
Clip to the top side
Inherited from
AABB.ClipTop
ClipFront
readonlystaticClipFront:number
Defined in: libs/base/dist/index.d.ts:4123
Clip to the front side
Inherited from
AABB.ClipFront
ClipBack
readonlystaticClipBack:number
Defined in: libs/base/dist/index.d.ts:4125
Clip to the back side
Inherited from
AABB.ClipBack
Accessors
minPoint
Get Signature
get minPoint():
Vector3
Defined in: libs/base/dist/index.d.ts:4142
Get the min point of the AABB.
Returns
Vector3
Set Signature
set minPoint(
p):void
Defined in: libs/base/dist/index.d.ts:4143
Parameters
p
Vector3
Returns
void
Inherited from
AABB.minPoint
maxPoint
Get Signature
get maxPoint():
Vector3
Defined in: libs/base/dist/index.d.ts:4145
Get the max point of the AABB.
Returns
Vector3
Set Signature
set maxPoint(
p):void
Defined in: libs/base/dist/index.d.ts:4146
Parameters
p
Vector3
Returns
void
Inherited from
AABB.maxPoint
extents
Get Signature
get extents():
Vector3
Defined in: libs/base/dist/index.d.ts:4148
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:4150
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:4152
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:4154
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:4159
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:4165
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:4170
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:4176
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:4184
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:4190
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:4195
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:4202
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:4208
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:4214
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:4220
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:4227
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:4233
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:4245
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:4252
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()
statictransform(bbox,matrix,result?):AABB
Defined in: libs/base/dist/index.d.ts:4260
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
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
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
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
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