ReadonlycenterCenter of box.
ReadonlyhalfHalf the distance across the box in each axis.
Combines two bounding boxes into one, enclosing both.
Bounding box to add.
Return the point on the AABB closest to a given point. If the point is inside the AABB, the point itself is returned.
The closest point on the AABB.
Compute the size of the AABB to encapsulate all specified vertices.
The vertices used to compute the new size for the AABB.
OptionalnumVerts: number
Number of vertices to use from the beginning of vertices array. All vertices are used if not specified.
Test if a point is inside an AABB.
Point to test.
True if the point is inside the AABB and false otherwise.
Copies the contents of a source AABB.
The AABB to copy from.
Reports whether two axis-aligned bounding boxes are equal.
The AABB to compare to.
True if the AABBs have the same center and half extents, false otherwise.
Test whether two axis-aligned bounding boxes intersect.
Bounding box to test against.
True if there is an intersection.
Test if a Bounding Sphere is overlapping, enveloping, or inside this AABB.
Bounding Sphere to test.
True if the Bounding Sphere is overlapping, enveloping, or inside the AABB and false otherwise.
Set an AABB to enclose the specified AABB if it were to be transformed by the specified 4x4 matrix.
Box to transform and enclose.
Transformation matrix to apply to source AABB.
If true is specified, a scale from the matrix is ignored. Defaults to false.
StaticcomputeCompute the min and max bounding values to encapsulate all specified vertices.
Axis-Aligned Bounding Box. An AABB is commonly used for fast overlap tests in collision detection, spatial indexing and frustum culling.
A box is stored as a center and halfExtents. Set it from its extreme corners with setMinMax and read them back with getMin and getMax. Fit a box to vertex data with compute, grow it to enclose another box with add, and move a local box into world space with setFromTransformedAabb, which is how the engine derives a mesh instance's world bounds from its mesh's local bounds.
Tests such as intersects, containsPoint and intersectsRay return a boolean and allocate nothing. closestPoint writes into an optional result vector, while getMin and getMax return the box's own cached vectors, which should be treated as read-only. The constructor copies the vectors it is given.
Example
Example