BoundingBox class

Represents an axis-aligned bounding box (AABB) in 3D space.

final box = BoundingBox();

final mesh = Mesh(
  SphereGeometry(),
  MeshBasicMaterial()
);

// ensure the bounding box is computed for its geometry
// this should be done only once (assuming static geometries)
mesh.geometry.computeBoundingBox();

// ...

// in the animation loop, compute the current bounding box with the world matrix
box.copy( mesh.geometry.boundingBox ).applyMatrix4( mesh.matrixWorld );

Constructors

BoundingBox([Vector3? min, Vector3? max])
min - (optional) Vector3 representing the lower (x, y, z) boundary of the box. Default is ( + Infinity, + Infinity, + Infinity ).
BoundingBox.copy(BoundingBox box)
box - BoundingBox to copy.

Properties

hashCode int
The hash code for this object.
no setterinherited
max Vector3
getter/setter pair
min Vector3
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clampPoint(Vector3 point, Vector3 target) Vector3
point - Vector3 to clamp.
clone() BoundingBox
Returns a new BoundingBox with the same min and max as this one.
containsPoint(Vector point) bool
point - Vector3 to check for inclusion.
empty() BoundingBox
Makes this box empty.
expandByPoint(Vector3 point) BoundingBox
point - Vector3 that should be included in the box.
expandByVector(Vector3 vector) BoundingBox
vector - Vector3 to expand the box by.
getCenter(Vector3 target) Vector3
target — the result will be copied into this Vector3.
intersectsBox(BoundingBox box) bool
box - Box to check for intersection against.
intersectsPlane(Plane plane) bool
plane - page:Plane to check for intersection against.
intersectsSphere(BoundingSphere sphere) bool
sphere - BoundingSphere to check for intersection against.
intersectsTriangle(Triangle triangle) bool
triangle - page:Triangle to check for intersection against.
isEmpty() bool
Returns true if this box includes zero points within its bounds.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
satForAxes<T extends num>(List<T> axes, Vector3 v0, Vector3 v1, Vector3 v2, Vector3 extents) bool
set(Vector3 min, Vector3 max) BoundingBox
min - Vector3 representing the lower (x, y, z) boundary of the box.
setFrom(BoundingBox box) BoundingBox
box - BoundingBox to copy.
setFromArray(List<double> array) BoundingBox
array - An array attribute of position data that the resulting box will envelop.
setFromBuffer(BufferAttribute<NativeArray<num>> source) BoundingBox
source - A buffer attribute of position data that the resulting box will envelop.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited