Box2

Represents an axis-aligned bounding box (AABB) in 2D space.

Constructor

new Box2(min, max)

Parameters:
NameTypeDescription
minVector2

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

maxVector2

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

Methods

clone() → {Box2}

Returns a new Box2 with the same min and max as this one.

Returns:
Type: 
Box2

copy(box) → {Box2}

Copies the min and max from box to this box.

Parameters:
NameTypeDescription
boxBox2
Returns:
Type: 
Box2

set(x1, y1, x2, y2)

Parameters:
NameTypeDescription
x1number
y1number
x2number
y2number