Box3
An axis-aligned bounding box (AABB) in 3D space defined by min and max vectors.
Constructor
const box = new Box3(min?, max?)
// defaults: min=(+Inf,+Inf,+Inf), max=(-Inf,-Inf,-Inf) (empty)
Properties
min,max— Vector3 boundsisBox3— Type flag (true)
Methods
Setting
set(min, max)— Set boundssetFromArray(array)— From flat position arraysetFromBufferAttribute(attribute)— From position buffer attributesetFromPoints(points)— From array of Vector3setFromCenterAndSize(center, size)— From center + dimensionssetFromObject(object, precise?)— Aggregate world-space bounds for an object hierarchycopy(box),makeEmpty()
setFromObject() prefers each object's engine-maintained boundingBoxWorld.
If unavailable, it transforms geometry.boundingBox by matrixWorld. Groups
contribute their descendants. Geometry-bearing objects without usable bounds
are warned about and skipped.
Queries
isEmpty()— True if anymaxcomponent is less than its matchingmingetCenter(target)— Center pointgetSize(target)— DimensionsgetParameter(point, target)— Point as proportion of box sizegetBoundingSphere(target)— Enclosing sphere
Testing
containsPoint(point),containsBox(box)intersectsBox(box),intersectsSphere(sphere),intersectsPlane(plane),intersectsTriangle(triangle)
Operations
expandByPoint(point),expandByVector(vector),expandByScalar(scalar)expandByObject(object, precise?)— Add world-space hierarchy boundsintersect(box)— Intersect with another boxunion(box)— Union with another boxclampPoint(point, target)— Clamp point to box boundsdistanceToPoint(point)— Distance from box edge to pointapplyMatrix4(matrix)— Transform boxtranslate(offset)— Translate box
Other
equals(box),clone()toJSON(),fromJSON(json)