Box

class Box()

Represents an axis-aligned bounding box. A box is represented by a minimum and maximum point which describe the extents of the box.

Constructors

Box.constructor()
Box(min: Point3?, max: Point3?): Box

Creates a new box.

Parameters

min: Point3 = …

The minimum extent of the box. Defaults to the origin.

max: Point3 = …

The maximum extent of the box. Defaults to the origin.

Returns: Box

Properties

Box.max
max: Point3

The point of maximum extent for the box.

Box.min
min: Point3

The point of minimum extent for the box.

Methods

Box.addBox()
addBox(box: Box): void

Expands the extents of the box so that it will contain another box.

Parameters

box: Box

The box to add.

Returns: void

Box.addPoint()
addPoint(point: Point3): void

Expands the extents of the box so that it will contain a particular point.

Parameters

point: Point3

The point to add.

Returns: void

Box.center()
center(): Point3

Gets the center point for the box.

Returns: Point3

The center point of this box.
Box.containsPoint()
containsPoint(point: Point3): boolean

Returns whether a point is contained within the box

Parameters

point: Point3

Returns: boolean

whether a point is contained within the box
Box.copy()
copy(): Box

Creates a copy of the box.

Returns: Box

A copy of this box.
Box.equals()
equals(box: Box): boolean

Strictly compares this box with another box.

Parameters

box: Box

Box to compare with.

Returns: boolean

True if the values of this box equals the other. False otherwise.
Box.extents()
extents(): Point3

Gets the extents of the box.

Returns: Point3

A point with members set to extent values for each corresponding axis.
Box.getCorners()
getCorners(): Point3[]

Gets all eight corner points for the box.

Returns: Point3[]

The corner points of this box.
Box.isDegenerate()
isDegenerate(): boolean

Returns whether or not the box is degenerate.

Returns: boolean

whether or not the box is degenerate.
Box.toJson()
toJson(): object

Creates an object ready for JSON serialization.

Returns: object

The prepared object.
static Box.fromJson()

static

fromJson(objData: unknown): Box

Creates a new [[Box]] from an object given by [[toJson]].

Parameters

objData: unknown

An object given by [[toJson]].

Returns: Box

The prepared object.
static Box.invalid()

static

invalid(): Box

Creates and returns an invalid bounding box.

Returns: Box

an invalid bounding box.