Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Box3

Represents an axis-aligned bounding box (AABB) in 3D space. See the ngx3js docs page for details.

Examples

webgl / loader / 3mf | webgl / loader / ldraw | webgl / materials / normalmap / object / space | webxr / vr / haptics

const box = new THREE.Box3();
const mesh = new THREE.Mesh(
new THREE.SphereGeometry(),
new THREE.MeshBasicMaterial()
);
// ensure the bounding box is computed for its geometry
// this should be done only once (assuming static geometries)
mesh.geometry.computeBoundingBox();
// ...
// in the animation loop, compute the current bounding box with the world matrix
box.copy( mesh.geometry.boundingBox ).applyMatrix4( mesh.matrixWorld );

Hierarchy

  • Box3

Index

Constructors

constructor

  • Creates a Box3 bounded by min and max.

    Parameters

    • Optional min: I3JS.Vector3

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

    • Optional max: I3JS.Vector3

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

    Returns I3JS.Box3

Properties

Readonly isBox3

isBox3: true

max

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

min

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

Methods

applyMatrix4

clampPoint

clone

containsBox

containsPoint

copy

distanceToPoint

equals

expandByObject

expandByPoint

expandByScalar

  • expandByScalar(scalar: number): I3JS.Box3

expandByVector

  • 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

    Returns I3JS.Box3

getBoundingSphere

getCenter

getParameter

getSize

intersect

  • Computes 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. If there's no overlap, makes this box empty.

    Parameters

    Returns I3JS.Box3

intersectsBox

intersectsPlane

intersectsSphere

intersectsTriangle

isEmpty

  • isEmpty(): boolean
  • Note that a box with equal lower and upper bounds still includes one point, the one both bounds share.

    Returns boolean

    Returns true if this box includes zero points within its bounds.

makeEmpty

set

  • Sets the lower and upper (x, y, z) boundaries of this box. Please note that this method only copies the values from the given objects.

    Parameters

    • min: I3JS.Vector3

      Vector3 representing the lower (x, y, z) boundary of the box.

    • max: I3JS.Vector3

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

    Returns I3JS.Box3

setFromArray

  • setFromArray(array: ArrayLike<number>): I3JS.Box3

setFromBufferAttribute

setFromCenterAndSize

setFromObject

setFromPoints

translate

union

  • Computes the union of this box and 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: I3JS.Box3

      Box that will be unioned with this box.

    Returns I3JS.Box3

Generated using TypeDoc