# [name]

Represents a box or cube in 3D space. The main purpose of this is to represent the world-axis-aligned bounding boxes for objects.

## Example

`// Creating the object whose bounding box we want to compute var sphereObject = new THREE.Mesh( new THREE.SphereGeometry(), new THREE.MeshBasicMaterial( 0xff0000 ) ); // Creating the actual bounding box with Box3 sphereObject.geometry.computeBoundingBox(); var box = sphereObject.geometry.boundingBox.clone(); // ... // In the animation loop, to keep the bounding box updated after move/rotate/scale operations sphereObject.updateMatrixWorld( true ); box.copy( sphereObject.geometry.boundingBox ).applyMatrix4( sphereObject.matrixWorld );`

## Constructor

### [name]( [param:Vector3 min], [param:Vector3 max] )

[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 lower upper (x, y, z) boundary of the box. Default is ( - Infinity, - Infinity, - Infinity ).
Creates a [name] bounded by min and max.

## Properties

### [property:Boolean isBox3]

Used to check whether this or derived classes are Box3s. Default is *true*.
You should not change this, as it used internally for optimisation.

### [property:Vector3 min]

[page:Vector3] representing the lower (x, y, z) boundary of the box.
Default is ( + Infinity, + Infinity, + Infinity ).

### [property:Vector3 max]

[page:Vector3] representing the upper (x, y, z) boundary of the box.
Default is ( - Infinity, - Infinity, - Infinity ).

## Methods

### [method:Box3 applyMatrix4]( [param:Matrix4 matrix] )

[page:Matrix4 matrix] - The [page:Matrix4] to apply
Transforms this Box3 with the supplied matrix.

### [method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 target] )

[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.

### [method:Box3 clone]()

Returns a new [page:Box3] with the same [page:.min min] and [page:.max max] as this one.

### [method:Boolean containsBox]( [param:Box3 box] )

[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.

### [method:Boolean containsPoint]( [param:Vector3 point] )

[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.

### [method:Box3 copy]( [param:Box3 box] )

[page:Box3 box] - [page:Box3] to copy.
Copies the [page:.min min] and [page:.max max] from [page:Box3 box] to this box.

### [method:Float distanceToPoint]( [param:Vector3 point] )

[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.

### [method:Boolean equals]( [param:Box3 box] )

[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.

### [method:Box3 expandByObject]( [param:Object3D object] )

[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.

### [method:Box3 expandByPoint]( [param:Vector3 point] )

[page:Vector3 point] - [page:Vector3] that should be included in the box.
Expands the boundaries of this box to include [page:Vector3 point].

### [method:Box3 expandByScalar]( [param:float scalar] )

[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.

### [method:Box3 expandByVector]( [param:Vector3 vector] )

[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.

### [method:Sphere getBoundingSphere]( [param:Sphere target] )

[page:Sphere target] — the result will be copied into this Sphere.
Gets a [page:Sphere] that bounds the box.

### [method:Vector3 getCenter]( [param:Vector3 target] )

[page:Vector3 target] — the result will be copied into this Vector3.
Returns the center point of the box as a [page:Vector3].

### [method:Vector3 getParameter]( [param:Vector3 point], [param:Vector3 target] )

[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.

### [method:Vector3 getSize]( [param:Vector3 target] )

[page:Vector3 target] — the result will be copied into this Vector3.
Returns the width, height and depth of this box.

### [method:Box3 intersect]( [param:Box3 box] )

[page:Box3 box] - Box to intersect with.
Returns 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.

### [method:Boolean intersectsBox]( [param:Box3 box] )

[page:Box3 box] - Box to check for intersection against.
Determines whether or not this box intersects [page:Box3 box].

### [method:Boolean intersectsPlane]( [param:Plane plane] )

[page:Plane plane] - [page:Plane] to check for intersection against.
Determines whether or not this box intersects [page:Plane plane].

### [method:Boolean intersectsSphere]( [param:Sphere sphere] )

[page:Sphere sphere] - [page:Sphere] to check for intersection against.
Determines whether or not this box intersects [page:Sphere sphere].

### [method:Boolean intersectsTriangle]( [param:Triangle triangle] )

[page:Triangle triangle] - [page:Triangle] to check for intersection against.
Determines whether or not this box intersects [page:Triangle triangle].

### [method:Boolean isEmpty]()

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.

### [method:Box3 makeEmpty]()

Makes this box empty.

### [method:Box3 set]( [param:Vector3 min], [param:Vector3 max] )

[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.

### [method:Box3 setFromArray]( [param:Array array] ) [param:Box3 this]

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*.

### [method:Box3 setFromBufferAttribute]( [param:BufferAttribute attribute] ) [param:Box3 this]

[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].

### [method:Box3 setFromCenterAndSize]( [param:Vector3 center], [param:Vector3 size] ) [param:Box3 this]

[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]

### [method:Box3 setFromObject]( [param:Object3D object] )

[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.

### [method:Box3 setFromPoints]( [param:Array points] )

[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].

### [method:Box3 translate]( [param:Vector3 offset] )

[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.

### [method:Box3 union]( [param:Box3 box] )

[page:Box3 box] - Box that will be unioned with this box.
Unions this box with [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.

## Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]