# Box3

Represents a box or cube in 3D space. The main purpose of this is to represent the Minimum Bounding Boxes for objects.

## Constructor

### Box3(min : Vector3, max : Vector3)

min - (optional) Vector3 representing the lower (x, y, z) boundary of the box. Default is (+ Infinity, + Infinity, + Infinity).
max - (optional) Vector3 representing the lower upper (x, y, z) boundary of the box. Default is (- Infinity, - Infinity, - Infinity).

Creates a Box3 bounded by min and max.

## Properties

### # .isBox3 : Boolean

Used to check whether this or derived classes are Box3s. Default is true.

You should not change this, as it used internally for optimisation.

### # .min : Vector3

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

### # .max : Vector3

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

## Methods

### # .applyMatrix4 (matrix : Matrix4) : Box3

matrix - The Matrix4 to apply

Transforms this Box3 with the supplied matrix.

### # .clampPoint (point : Vector3, target : Vector3) : Vector3

point - Vector3 to clamp.
target — the result will be copied into this Vector3.

Clamps the point within the bounds of this box.

### # .clone () : Box3

Returns a new Box3 with the same min and max as this one.

### # .containsBox (box : Box3) : Boolean

box - Box3 to test for inclusion.

Returns true if this box includes the entirety of box. If this and box are identical,
this function also returns true.

### # .containsPoint (point : Vector3) : Boolean

point - Vector3 to check for inclusion.

Returns true if the specified point lies within or on the boundaries of this box.

### # .copy (box : Box3) : Box3

box - Box3 to copy.

Copies the min and max from box to this box.

### # .distanceToPoint (point : Vector3) : Float

point - Vector3 to measure distance to.

Returns the distance from any edge of this box to the specified point. If the point lies inside of this box, the distance will be 0.

### # .equals (box : Box3) : Boolean

box - Box to compare with this one.

Returns true if this box and box share the same lower and upper bounds.

### # .expandByObject (object : Object3D) : Box3

object - Object3D to expand the box by.

Expands the boundaries of this box to include object and its children, accounting for the object's, and children's, world transforms.

### # .expandByPoint (point : Vector3) : Box3

point - Vector3 that should be included in the box.

Expands the boundaries of this box to include point.

### # .expandByScalar (scalar : float) : Box3

scalar - Distance to expand the box by.

Expands each dimension of the box by scalar. If negative, the dimensions of the box will be contracted.

### # .expandByVector (vector : Vector3) : Box3

vector - Vector3 to expand the box by.

Expands this box equilaterally by vector. The width of this box will be expanded by the x component of vector in both directions. The height of this box will be expanded by the y component of vector in both directions. The depth of this box will be expanded by the z component of vector in both directions.

### # .getBoundingSphere (target : Sphere) : Sphere

target — the result will be copied into this Sphere.

Gets a Sphere that bounds the box.

### # .getCenter (target : Vector3) : Vector3

target — the result will be copied into this Vector3.

Returns the center point of the box as a Vector3.

### # .getParameter (point : Vector3, target : Vector3) : Vector3

point - Vector3.
target — the result will be copied into this Vector3.

Returns a point as a proportion of this box's width and height.

### # .getSize (target : Vector3) : Vector3

target — the result will be copied into this Vector3.

Returns the width, height and depth of this box.

### # .intersect (box : Box3) : Box3

box - Box to intersect with.

Returns the intersection of this and 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.

### # .intersectsBox (box : Box3) : Boolean

box - Box to check for intersection against.

Determines whether or not this box intersects box.

### # .intersectsPlane (plane : Plane) : Boolean

plane - Plane to check for intersection against.

Determines whether or not this box intersects plane.

### # .intersectsSphere (sphere : Sphere) : Boolean

sphere - Sphere to check for intersection against.

Determines whether or not this box intersects sphere.

### # .intersectsTriangle (triangle : Triangle) : Boolean

triangle - Triangle to check for intersection against.

Determines whether or not this box intersects triangle.

### # .isEmpty () : Boolean

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.

### # .makeEmpty () : Box3

Makes this box empty.

### # .set (min : Vector3, max : Vector3) : Box3

min - Vector3 representing the lower (x, y, z) boundary of the box.
max - Vector3 representing the lower upper (x, y, z) boundary of the box.

Sets the lower and upper (x, y, z) boundaries of this box.

### # .setFromArray (array : Array) : Box3 this : Box3

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.

### # .setFromBufferAttribute (attribute : BufferAttribute) : Box3 this : Box3

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

### # .setFromCenterAndSize (center : Vector3, size : Vector3) : Box3 this : Box3

center, - Desired center position of the box.
size - Desired x, y and z dimensions of the box.

Centers this box on center and sets this box's width, height and depth to the values specified
in size

### # .setFromObject (object : Object3D) : Box3

object - Object3D to compute the bounding box of.

Computes the world-axis-aligned bounding box of an Object3D (including its children), accounting for the object's, and children's, world transforms.

### # .setFromPoints (points : Array) : Box3

points - Array of Vector3s that the resulting box will contain.

Sets the upper and lower bounds of this box to include all of the points in points.

### # .translate (offset : Vector3) : Box3

offset - Direction and distance of offset.

Adds offset to both the upper and lower bounds of this box, effectively moving this box offset units in 3D space.

### # .union (box : Box3) : Box3

box - Box that will be unioned with this box.

Unions this box with 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.