Skip to content

Bounds

Represents a bounding box in 3D space.

Properties

  • Center: Vector3
  • Size: Vector3
  • Extents: Vector3
  • Start: Vector3
  • End: Vector3
  • Volume: number

Methods

New() → Bounds

Creates a new Bounds object with the specified position and size.

New(position: Vector3, size: Vector3) → Bounds

Creates a new Bounds object with the specified position and size.

ClosestPoint(bounds: Bounds, point: Vector3) → Vector3

Calculates the closest point on the bounds to the specified point.

Contains(bounds: Bounds, point: Vector3) → boolean

Returns whether the bounds contain the specified point.

Encapsulate(bounds: Bounds, point: Vector3) → Bounds

Expands the bounds by the specified amount.

Expand(bounds: Bounds, amount: number) → Bounds

Expands the bounds by the specified amount.

Intersects(bounds: Bounds, other: Bounds) → boolean

Determines whether the bounds intersect with another bounds.

SetMinMax(bounds: Bounds, min: Vector3, max: Vector3) → Bounds

Sets the minimum and maximum points of the bounds.

Distance(bounds: Bounds, point: Vector3) → number

Calculates the distance from the bounds to the specified point.

SqrDistance(bounds: Bounds, point: Vector3) → number

Calculates the squared distance from the bounds to the specified point.