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?)— From Object3D hierarchycopy(box),makeEmpty()
Queries
isEmpty()— True if box encloses zero volumegetCenter(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?)intersect(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)