# BoundingBox

BoundingBox

## Constructor

#### new BoundingBox(min, max)

Constructs a new bounding box from two corner points.
##### Parameters:
Name Type Description
`min` Array.<x, y, z> Point containing all the minimum coordinates.
`max` Array.<x, y, z> Point containing all the maximum coordinates.

### Members

#### area :double

Gets the area of this BoundingBox.
• double

#### center :Array.<x, y, z>

Gets the point in the center of the bounding box.
##### Type:
• Array.<x, y, z>

#### diagonal :Array.<x, y, z>

Gets the diagonal vector of this BoundingBox. The diagonal connects the Min and Max points.
##### Type:
• Array.<x, y, z>

#### isValid :bool

Gets a value that indicates whether or not this bounding box is valid. Empty boxes are not valid, and neither are boxes with unset points.
• bool

#### max :Array.<x, y, z>

Gets or sets the point in the maximal corner.
##### Type:
• Array.<x, y, z>

#### min :Array.<x, y, z>

Gets or sets the point in the minimal corner.
##### Type:
• Array.<x, y, z>

#### volume :double

Gets the volume of this BoundingBox.
• double

### Methods

...

#### (static) union(a, b) → {BoundingBox}

Returns a new BoundingBox that represents the union of boxes a and b.
##### Parameters:
Name Type Description
`a` BoundingBox First box to include in union.
`b` BoundingBox Second box to include in union.
##### Returns:
The BoundingBox that contains both a and b.
Type
BoundingBox

#### closestPoint(point) → {Array.<x, y, z>}

Finds the closest point on or in the bounding box.
##### Parameters:
Name Type Description
`point` Array.<x, y, z> Sample point.
##### Returns:
The point on or in the box that is closest to the sample point.
Type
Array.<x, y, z>

#### contains(point) → {bool}

Tests a point for bounding box inclusion. This is the same as calling Contains(point, false)
##### Parameters:
Name Type Description
`point` Array.<x, y, z> Point to test.
##### Returns:
true if the point is on the inside of or coincident with this bounding box; otherwise false.
Type
bool

...

#### inflate(amount)

Inflates the box with equal amounts in all directions. Inflating with negative amounts may result in decreasing boxes. Invalid boxes can not be inflated.
##### Parameters:
Name Type Description
`amount` double Amount (in model units) to inflate this box in all directions.

#### inflate(xAmount, yAmount, zAmount)

Inflate the box with custom amounts in all directions. Inflating with negative amounts may result in decreasing boxes. InValid boxes can not be inflated.
##### Parameters:
Name Type Description
`xAmount` double Amount (in model units) to inflate this box in the x direction.
`yAmount` double Amount (in model units) to inflate this box in the y direction.
`zAmount` double Amount (in model units) to inflate this box in the z direction.

#### isDegenerate(tolerance) → {int}

Determines whether a bounding box is degenerate (flat) in one or more directions.
##### Parameters:
Name Type Description
`tolerance` double Distances <= tolerance will be considered to be zero. If tolerance is negative (default), then a scale invariant tolerance is used.
##### Returns:
0 = box is not degenerate 1 = box is a rectangle (degenerate in one direction). 2 = box is a line (degenerate in two directions). 3 = box is a point (degenerate in three directions) 4 = box is not valid.
Type
int

#### toBrep() → {Brep}

Constructs a representation of this bounding box.
##### Returns:
If this operation is successful, a Brep representation of this box; otherwise null.
Type
Brep

...

#### transform(xform) → {bool}

Updates this bounding box to be the smallest axis aligned bounding box that contains the transformed result of its 8 original corner points.
##### Parameters:
Name Type Description
`xform` Transform A transform.
##### Returns:
true if this operation is successful; otherwise false.
Type
bool