dot big bang

Developer API
Menu

Class Box3

All
  • Public
  • Public/Protected
  • All

Hierarchy

  • Box3

Index

Constructors

constructor

  • Creates a box bounded by min and max.

    Parameters

    • Optional min: Vector3

      Lower (x, y, z) boundary of the box. Default is (+Infinity, +Infinity, +Infinity).

    • Optional max: Vector3

      Upper (x, y, z) boundary of the box. Default is (-Infinity, -Infinity, -Infinity).

    Returns Box3

Properties

max

max: Vector3

The upper (x, y, z) boundary of this box.

min

min: Vector3

The lower (x, y, z) boundary of this box.

Methods

applyMatrix4

  • Transforms this box with the supplied matrix.

    Parameters

    Returns Box3

center

  • Returns the center point of this box.

    Parameters

    • Optional optionalTarget: Vector3

      If specified, the result will be copied here.

    Returns Vector3

clampPoint

  • Clamps point within the bounds of this box.

    Parameters

    • point: Vector3

      Position to clamp.

    • Optional optionalTarget: Vector3

      If specified, the clamped result will be copied here.

    Returns Vector3

clone

  • Returns a copy of this box.

    Returns Box3

containsBox

  • containsBox(box: Box3): boolean
  • Returns true if this box includes the entirety of box. If this and box overlap exactly, this function also returns true.

    Parameters

    • box: Box3

      Box to test for inclusion.

    Returns boolean

containsPoint

  • containsPoint(point: Vector3): boolean
  • Returns true if the specified point lies within the boundaries of this box.

    Parameters

    Returns boolean

copy

  • Copies the values of box to this box.

    Parameters

    • box: Box3

      Box to copy.

    Returns Box3

distanceToPoint

  • distanceToPoint(point: Vector3): number
  • 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.

    Parameters

    • point: Vector3

      Point to measure distance to.

    Returns number

equals

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

    Parameters

    • box: Box3

      Box to compare.

    Returns Box3

expandByPoint

  • Expands the boundaries of this box to include the provided point.

    Parameters

    • point: Vector3

      Point that should be included in the box.

    Returns Box3

expandByScalar

  • expandByScalar(scalar: number): Box3
  • 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.

    Parameters

    • scalar: number

    Returns Box3

expandByVector

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

    Parameters

    Returns Box3

getBoundingSphere

  • Gets a sphere that bounds the box.

    Parameters

    • optionalTarget: Sphere

      Sphere to optionally set the result to.

    Returns Sphere

getParameter

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

    Parameters

    • point: Vector3

      Point to parametrize.

    • Optional optionalTarget: Vector3

      If specified, the result will be copied here.

    Returns Vector3

intersect

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

    Parameters

    • box: Box3

      Box to intersect with.

    Returns Box3

intersectsBox

  • intersectsBox(box: Box3): boolean
  • Determines whether or not this box intersects box.

    Parameters

    • box: Box3

      Box to check for intersection against.

    Returns boolean

intersectsPlane

  • intersectsPlane(plane: Plane): boolean
  • Determines whether or not this box intersects plane.

    Parameters

    • plane: Plane

      Plane to check for intersection against.

    Returns boolean

intersectsSphere

  • intersectsSphere(sphere: Sphere): boolean
  • Determines whether or not this box intersects sphere.

    Parameters

    • sphere: Sphere

      Sphere to check for intersection against.

    Returns boolean

isEmpty

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

    Returns boolean

makeEmpty

  • Makes this box empty.

    Returns Box3

set

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

    Parameters

    • min: Vector3

      Lower (x, y, z) boundary of the box.

    • max: Vector3

      Upper (x, y, z) boundary of the box.

    Returns Box3

setFromArray

  • setFromArray(array: number[]): Box3
  • Sets the upper and lower bounds of this box to include all of the data in array.

    Parameters

    • array: number[]

      An array of position data that the resulting box will envelop.

    Returns Box3

setFromCenterAndSize

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

    Parameters

    • center: Vector3

      Desired center position of the box.

    • size: Vector3

      Desired x and y dimensions of the box.

    Returns Box3

setFromPoints

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

    Parameters

    • points: Vector3[]

      Set of points that the resulting box will envelop.

    Returns Box3

size

  • Returns the width, height, and depth of this box.

    Parameters

    • Optional optionalTarget: Vector3

      If specified, the result will be copied here.

    Returns Vector3

translate

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

    Parameters

    • offset: Vector3

      Direction and distance of offset.

    Returns Box3

union

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

    Parameters

    • box: Box3

      Box that will be unioned with this box.

    Returns Box3