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

Properties


Constructors

Box.constructor(min, max)
Arguments
  • min (Point3()) – The minimum extent of the box. Defaults to the origin.

  • max (Point3()) – The maximum extent of the box. Defaults to the origin.

Creates a new box.

Return type

Box

Properties

Box.max
Type

Point3

The point of maximum extent for the box.

Box.min
Type

Point3

The point of minimum extent for the box.

Methods

addBox

Box.addBox(box)
Arguments
  • box (Box()) – The box to add.

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

Return type

void

addPoint

Box.addPoint(point)
Arguments
  • point (Point3()) – The point to add.

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

Return type

void

center

Box.center()

Gets the center point for the box.

Returns

The center point of this box.

Return type

Point3

copy

Box.copy()

Creates a copy of the box.

Returns

A copy of this box.

Return type

Box

equals

Box.equals(box)
Arguments
  • box (Box()) – Box to compare with.

Strictly compares this box with another box.

Returns

True if the values of this box equals the other. False otherwise.

Return type

boolean

extents

Box.extents()

Gets the extents of the box.

Returns

A point with members set to extent values for each corresponding axis.

Return type

Point3

getCorners

Box.getCorners()

Gets all eight corner points for the box.

Returns

The corner points of this box.

Return type

[Point3]

isDegenerate

Box.isDegenerate()

Returns whether or not the box is degenerate.

Returns

whether or not the box is degenerate.

Return type

boolean

toJson

Box.toJson()

Creates an object ready for JSON serialization.

Returns

The prepared object.

Return type

object

static fromJson

Box.fromJson(objData)
Arguments
  • objData (unknown()) – An object given by [[toJson]].

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

Returns

The prepared object.

Return type

Box

static invalid

Box.invalid()

Creates and returns an invalid bounding box.

Returns

an invalid bounding box.

Return type

Box