Represents an axis-aligned bounding box (AABB) in 3D space.
const box = new THREE.Box3();
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(),
new THREE.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 );
[page:Vector3 min] - (optional) [page:Vector3] representing the lower (x, y, z) boundary of the box.
Default is ( + Infinity, + Infinity, + Infinity ).
[page:Vector3 max] - (optional) [page:Vector3] representing the upper (x, y, z) boundary of the box.
Default is ( - Infinity, - Infinity, - Infinity ).
Creates a [name] bounded by min and max.
[page:Vector3] representing the lower (x, y, z) boundary of the box.
Default is ( + Infinity, + Infinity, + Infinity ).
[page:Vector3] representing the upper (x, y, z) boundary of the box.
Default is ( - Infinity, - Infinity, - Infinity ).
[page:Matrix4 matrix] - The [page:Matrix4] to apply
Transforms this Box3 with the supplied matrix.
[page:Vector3 point] - [page:Vector3] to clamp.
[page:Vector3 target] — the result will be copied into this Vector3.
[link:https://en.wikipedia.org/wiki/Clamping_(graphics) Clamps] the [page:Vector3 point] within the bounds of this box.
Returns a new [page:Box3] with the same [page:.min min] and [page:.max max] as this one.
[page:Box3 box] - [page:Box3 Box3] to test for inclusion.
Returns true if this box includes the entirety of [page:Box3 box]. If this and [page:Box3 box] are identical,
this function also returns true.
[page:Vector3 point] - [page:Vector3] to check for inclusion.
Returns true if the specified [page:Vector3 point] lies within or on the boundaries of this box.
[page:Box3 box] - [page:Box3] to copy.
Copies the [page:.min min] and [page:.max max] from [page:Box3 box] to this box.
[page:Vector3 point] - [page:Vector3] to measure distance to.
Returns the distance from any edge of this box to the specified point.
If the [page:Vector3 point] lies inside of this box, the distance will be 0.
[page:Box3 box] - Box to compare with this one.
Returns true if this box and [page:Box3 box] share the same lower and upper bounds.
[page:Object3D object] - [page:Object3D] to expand the box by.
Expands the boundaries of this box to include [page:Object3D object] and its children,
accounting for the object's, and children's, world transforms.
The function may result in a larger box than strictly necessary.
[page:Vector3 point] - [page:Vector3] that should be included in the box.
Expands the boundaries of this box to include [page:Vector3 point].
[page:Float scalar] - Distance to expand the box by.
Expands each dimension of the box by [page:Float scalar]. If negative, the dimensions of the box
will be contracted.
[page:Vector3 vector] - [page:Vector3] to expand the box by.
Expands this box equilaterally by [page:Vector3 vector]. The width of this box will be
expanded by the x component of [page:Vector3 vector] in both directions. The height of
this box will be expanded by the y component of [page:Vector3 vector] in both directions.
The depth of this box will be expanded by the z component of *vector* in both directions.
[page:Sphere target] — the result will be copied into this Sphere.
Gets a [page:Sphere] that bounds the box.
[page:Vector3 target] — the result will be copied into this Vector3.
Returns the center point of the box as a [page:Vector3].
[page:Vector3 point] - [page:Vector3].
[page:Vector3 target] — the result will be copied into this Vector3.
Returns a point as a proportion of this box's width and height.
[page:Vector3 target] — the result will be copied into this Vector3.
Returns the width, height and depth of this box.
[page:Box3 box] - Box to intersect with.
Computes the intersection of this and [page:Box3 box], setting the upper bound of this box to the lesser
of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes'
lower bounds. If there's no overlap, makes this box empty.
[page:Box3 box] - Box to check for intersection against.
Determines whether or not this box intersects [page:Box3 box].
[page:Plane plane] - [page:Plane] to check for intersection against.
Determines whether or not this box intersects [page:Plane plane].
[page:Sphere sphere] - [page:Sphere] to check for intersection against.
Determines whether or not this box intersects [page:Sphere sphere].
[page:Triangle triangle] - [page:Triangle] to check for intersection against.
Determines whether or not this box intersects [page:Triangle triangle].
Returns true if this box includes zero points within its bounds.
Note that a box with equal lower and upper bounds still includes one point,
the one both bounds share.
Makes this box empty.
[page:Vector3 min] - [page:Vector3] representing the lower (x, y, z) boundary of the box.
[page:Vector3 max] - [page:Vector3] representing the lower upper (x, y, z) boundary of the box.
Sets the lower and upper (x, y, z) boundaries of this box.
Please note that this method only copies the values from the given objects.
array -- An array of position data that the resulting box will envelop.
Sets the upper and lower bounds of this box to include all of the data in *array*.
[page:BufferAttribute attribute] - A buffer attribute of position data that the resulting box will envelop.
Sets the upper and lower bounds of this box to include all of the data in [page:BufferAttribute attribute].
[page:Vector3 center], - Desired center position of the box.
[page:Vector3 size] - Desired x, y and z dimensions of the box.
Centers this box on [page:Vector3 center] and sets this box's width, height and depth to the values specified
in [page:Vector3 size]
[page:Object3D object] - [page:Object3D] to compute the bounding box of.
Computes the world-axis-aligned bounding box of an [page:Object3D] (including its children),
accounting for the object's, and children's, world transforms.
The function may result in a larger box than strictly necessary.
[page:Array points] - Array of [page:Vector3 Vector3s] that the resulting box will contain.
Sets the upper and lower bounds of this box to include all of the points in [page:Array points].
[page:Vector3 offset] - Direction and distance of offset.
Adds [page:Vector3 offset] to both the upper and lower bounds of this box, effectively moving this box
[page:Vector3 offset] units in 3D space.
[page:Box3 box] - Box that will be unioned with this box.
Computes the union of this box and [page:Box3 box], setting the upper bound of this box to the greater of the
two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes'
lower bounds.
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]